From 158e063fd3c78112460869eca6e07cbe8ef4b471 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 28 Dec 2022 09:41:04 +0000 Subject: [PATCH] Handy's Block Checker Event adjustments and removals. --- .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../game/data/stats/skills/05800-05899.xml | 6 + .../game/data/stats/skills/documentation.txt | 1 + .../instancemanager/games/BlockChecker.java | 2 + .../instancemanager/games/BlockChecker.java | 2 + .../instancemanager/games/BlockChecker.java | 2 + .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 22 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../dist/game/config/General.ini | 20 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../dist/game/config/General.ini | 22 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../dist/game/config/General.ini | 22 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../dist/game/config/General.ini | 22 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../dist/game/config/General.ini | 22 - .../scripts/custom/events/TeamVsTeam/TvT.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 1 - .../data/scripts/handlers/MasterHandler.java | 2 - .../handlers/effecthandlers/FlipBlock.java | 76 -- .../handlers/itemhandlers/EventItem.java | 107 --- .../handlers/itemhandlers/SummonItems.java | 2 +- .../java/org/l2jmobius/Config.java | 14 - .../gameserver/enums/InstanceType.java | 1 - .../HandysBlockCheckerManager.java | 375 --------- .../instancemanager/games/BlockChecker.java | 762 ------------------ .../tasks/PenaltyRemoveTask.java | 39 - .../model/ArenaParticipantsHolder.java | 176 ---- .../gameserver/model/actor/Creature.java | 5 - .../gameserver/model/actor/Player.java | 40 - .../model/actor/instance/Block.java | 162 ---- .../gameserver/network/ExClientPackets.java | 4 +- .../RequestExCubeGameChangeTeam.java | 82 -- .../RequestExCubeGameReadyAnswer.java | 72 -- .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- 309 files changed, 173 insertions(+), 27147 deletions(-) delete mode 100644 L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/EventItem.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/instance/Block.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java delete mode 100644 L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/05800-05899.xml index 3b83ef13ae..573e34d015 100644 --- a/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/05800-05899.xml @@ -1195,6 +1195,9 @@ -5 OTHERS SINGLE + + + @@ -1208,6 +1211,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/documentation.txt index c66abf5ae3..77792c9fee 100644 --- a/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_01.0_Ertheia/dist/game/data/stats/skills/documentation.txt @@ -123,6 +123,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/05800-05899.xml index 0684f40130..9afa893347 100644 --- a/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/documentation.txt index c66abf5ae3..77792c9fee 100644 --- a/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_02.5_Underground/dist/game/data/stats/skills/documentation.txt @@ -123,6 +123,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/05800-05899.xml index 0684f40130..9afa893347 100644 --- a/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/documentation.txt index c66abf5ae3..77792c9fee 100644 --- a/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_03.0_Helios/dist/game/data/stats/skills/documentation.txt @@ -123,6 +123,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/05800-05899.xml index b0ebb98abc..f47fcb57cc 100644 --- a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt index 5a5e16fb1e..9a26f93539 100644 --- a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt @@ -126,6 +126,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/05800-05899.xml index 36f87a47f1..4e3723f661 100644 --- a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt index 5d61e7ca6b..17e3932a4c 100644 --- a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt @@ -129,6 +129,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/05800-05899.xml index 61c5e4e3a1..9dda845502 100644 --- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt index 81f698c478..14ce2fc2f1 100644 --- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt @@ -130,6 +130,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/05800-05899.xml index 07ca466af6..4bc5f7a1c6 100644 --- a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt index 81f698c478..14ce2fc2f1 100644 --- a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt @@ -130,6 +130,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/05800-05899.xml index e6b39adcab..b12f2f724f 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt index 02e7c02ef1..f3b83fbc93 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt @@ -130,6 +130,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/05800-05899.xml index 0a36ba30b8..233e952413 100644 --- a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt index 744559410f..ce3b41f0b8 100644 --- a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt @@ -131,6 +131,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/05800-05899.xml index adf0d4e1ed..30916f2d40 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt index 1e0a572955..0b43751407 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt @@ -131,6 +131,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/05800-05899.xml index e6b2317a80..724db6195d 100644 --- a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt index 6097f16504..9cd993dc4a 100644 --- a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt @@ -133,6 +133,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/05800-05899.xml b/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/05800-05899.xml index 5e41bfa552..c4e89b97d9 100644 --- a/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/05800-05899.xml +++ b/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/05800-05899.xml @@ -1222,6 +1222,9 @@ -5 OTHERS SINGLE + + + @@ -1235,6 +1238,9 @@ -5 OTHERS SINGLE + + + diff --git a/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt index 6097f16504..9cd993dc4a 100644 --- a/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt @@ -133,6 +133,7 @@ Fear: Causes the target to run away. Does not block it though. Feed: Gives food to pet. FishingExpSpBonus: Bonus Exp and SP from fishing. (l2jmobius) Flag: Starts pvpflag. +FlipBlock: Effect for Handy's Block Checker Event. (l2jmobius) FlyMove: Moves towards target location. FocusEnergy: Max momentum stat. FocusMaxMomentum: Increases momentum to its maximum. diff --git a/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index dbe4969dba..a99b5f0a7f 100644 --- a/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -726,6 +726,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index 31954fb98f..b0b88b944e 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -719,6 +719,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java index 31954fb98f..b0b88b944e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java @@ -719,6 +719,8 @@ public class BlockChecker player.setTeam(Team.NONE); // Set default arena player.setBlockCheckerArena(DEFAULT_ARENA); + // Untransform. + player.untransform(); // Remove the event items final PlayerInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) diff --git a/L2J_Mobius_Classic_1.0/dist/game/config/General.ini b/L2J_Mobius_Classic_1.0/dist/game/config/General.ini index 797b32ad08..fbea5f2ea0 100644 --- a/L2J_Mobius_Classic_1.0/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_1.0/dist/game/config/General.ini @@ -582,26 +582,6 @@ CustomBuyListLoad = True BookmarkConsumeItemId = 20033 -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/EffectMasterHandler.java index 3a05ccde62..59afec97b7 100644 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -150,7 +150,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java index 85c3e435c2..2532718d5d 100644 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java @@ -193,7 +193,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -515,7 +514,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 3aeadd38a7..ab73e794ad 100644 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java index a298eb10e7..ea96016466 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java @@ -603,9 +603,6 @@ public class Config public static boolean CUSTOM_MULTISELL_LOAD; public static boolean CUSTOM_BUYLIST_LOAD; public static int BOOKMARK_CONSUME_ITEM_ID; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2039,17 +2036,6 @@ public class Config CUSTOM_MULTISELL_LOAD = generalConfig.getBoolean("CustomMultisellLoad", false); CUSTOM_BUYLIST_LOAD = generalConfig.getBoolean("CustomBuyListLoad", false); BOOKMARK_CONSUME_ITEM_ID = generalConfig.getInt("BookmarkConsumeItemId", -1); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/enums/InstanceType.java index 8d4cb93edb..5511d9b5f9 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Creature.java index d097482bf6..227edc8271 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4167,11 +4167,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Player.java index a067df8c19..be876c0fb7 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -114,7 +114,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -126,7 +125,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.CommandChannel; import org.l2jmobius.gameserver.model.ContactList; @@ -721,8 +719,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1047,20 +1043,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10764,18 +10746,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13094,16 +13064,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/ExClientPackets.java index c52337edc6..6c9b872012 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -167,9 +167,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/config/General.ini b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/config/General.ini index f17bd4455f..8988393fe5 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/config/General.ini @@ -582,26 +582,6 @@ CustomBuyListLoad = True BookmarkConsumeItemId = 20033 -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/EffectMasterHandler.java index 662c316d75..5f28fb2fe7 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -150,7 +150,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java index 85c3e435c2..2532718d5d 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java @@ -193,7 +193,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -515,7 +514,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java index 5d993138d8..c19dd85a8b 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java @@ -613,9 +613,6 @@ public class Config public static boolean CUSTOM_MULTISELL_LOAD; public static boolean CUSTOM_BUYLIST_LOAD; public static int BOOKMARK_CONSUME_ITEM_ID; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2068,17 +2065,6 @@ public class Config CUSTOM_MULTISELL_LOAD = generalConfig.getBoolean("CustomMultisellLoad", false); CUSTOM_BUYLIST_LOAD = generalConfig.getBoolean("CustomBuyListLoad", false); BOOKMARK_CONSUME_ITEM_ID = generalConfig.getInt("BookmarkConsumeItemId", -1); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/enums/InstanceType.java index 8d4cb93edb..5511d9b5f9 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Creature.java index d097482bf6..227edc8271 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4167,11 +4167,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Player.java index e5b207702a..7f2b2a76c4 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -117,7 +117,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -129,7 +128,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.CommandChannel; import org.l2jmobius.gameserver.model.ContactList; @@ -729,8 +727,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1056,20 +1052,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10775,18 +10757,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13105,16 +13075,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 9c8cab9206..e354120db7 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -172,9 +172,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini index 6f838fd1b3..5a12b6e652 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini @@ -598,26 +598,6 @@ AltBirthdayMailSubject = Happy Birthday! # $s1: Age AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java index 662c316d75..5f28fb2fe7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -150,7 +150,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java index d32310267f..e51e90262c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java @@ -194,7 +194,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -517,7 +516,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java index b34b075689..224ea44843 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java @@ -616,9 +616,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2074,17 +2071,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java index 8d4cb93edb..5511d9b5f9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java index d097482bf6..227edc8271 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4167,11 +4167,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java index e5b207702a..7f2b2a76c4 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -117,7 +117,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -129,7 +128,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.CommandChannel; import org.l2jmobius.gameserver.model.ContactList; @@ -729,8 +727,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1056,20 +1052,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10775,18 +10757,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13105,16 +13075,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 2e1a8f78fb..3c7d03e8d7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -179,9 +179,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/config/General.ini b/L2J_Mobius_Classic_2.5_Zaken/dist/game/config/General.ini index 6f838fd1b3..5a12b6e652 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/config/General.ini @@ -598,26 +598,6 @@ AltBirthdayMailSubject = Happy Birthday! # $s1: Age AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java index 662c316d75..5f28fb2fe7 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -150,7 +150,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java index d32310267f..e51e90262c 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java @@ -194,7 +194,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -517,7 +516,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java index e4fdcfa8e0..9d8fab3242 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java @@ -616,9 +616,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2078,17 +2075,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/enums/InstanceType.java index 8d4cb93edb..5511d9b5f9 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java index d097482bf6..227edc8271 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4167,11 +4167,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Player.java index f9dddaa85d..5c1e95a26e 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -117,7 +117,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -129,7 +128,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.CommandChannel; import org.l2jmobius.gameserver.model.ContactList; @@ -729,8 +727,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1056,20 +1052,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10775,18 +10757,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13105,16 +13075,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 1e0216afb5..5337e509fe 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -182,9 +182,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/config/General.ini b/L2J_Mobius_Classic_2.7_Antharas/dist/game/config/General.ini index 6f838fd1b3..5a12b6e652 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/config/General.ini @@ -598,26 +598,6 @@ AltBirthdayMailSubject = Happy Birthday! # $s1: Age AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java index 817839221c..5b189d6c4f 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -152,7 +152,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java index d32310267f..e51e90262c 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java @@ -194,7 +194,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -517,7 +516,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java index e4fdcfa8e0..9d8fab3242 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java @@ -616,9 +616,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2078,17 +2075,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/enums/InstanceType.java index 8d4cb93edb..5511d9b5f9 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java index 879b9cbae5..c9b05cec9c 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4167,11 +4167,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Player.java index 5213ae3a69..009e6ddbb5 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -117,7 +117,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -129,7 +128,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.CommandChannel; import org.l2jmobius.gameserver.model.ContactList; @@ -727,8 +725,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1054,20 +1050,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10761,18 +10743,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13091,16 +13061,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 4cc24b6e7b..21ca42b0a3 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -182,9 +182,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/config/General.ini b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/config/General.ini index 6f838fd1b3..5a12b6e652 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/config/General.ini @@ -598,26 +598,6 @@ AltBirthdayMailSubject = Happy Birthday! # $s1: Age AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java index 49ce63f0d5..8e94882ee2 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -155,7 +155,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java index c2b2718091..43c22884a8 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java @@ -195,7 +195,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -519,7 +518,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java index e4fdcfa8e0..9d8fab3242 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java @@ -616,9 +616,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2078,17 +2075,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java index 9b5a683a98..a054cf35bc 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4180,11 +4180,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Player.java index a98a7caa36..e935bec479 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -120,7 +120,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -132,7 +131,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -737,8 +735,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1081,20 +1077,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10807,18 +10789,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13156,16 +13126,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/ExClientPackets.java index ff4153e368..086284a6a6 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -193,9 +193,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/config/General.ini b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/config/General.ini index 5ea87c0335..0ae1401032 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/config/General.ini @@ -598,26 +598,6 @@ AltBirthdayMailSubject = Happy Birthday! # $s1: Age AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java index 49ce63f0d5..8e94882ee2 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -155,7 +155,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/MasterHandler.java index ba375bafe7..f6178435d7 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/MasterHandler.java @@ -196,7 +196,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -521,7 +520,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/Config.java index ca61ad27d3..acb8f8ecab 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/Config.java @@ -617,9 +617,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2130,17 +2127,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 3d2ae8dd28..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_YOU_HAVE_ALREADY_REGISTERED_FOR_THE_MATCH); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java index d354556130..5ad7baaba0 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4180,11 +4180,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java index c00c9917ef..573d78c4e4 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -120,7 +120,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -132,7 +131,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -745,8 +743,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1093,20 +1089,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10870,18 +10852,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13220,16 +13190,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 0cf490599e..333bb998d5 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -199,9 +199,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/config/General.ini b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/config/General.ini index 6f838fd1b3..5a12b6e652 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/config/General.ini @@ -598,26 +598,6 @@ AltBirthdayMailSubject = Happy Birthday! # $s1: Age AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java index 49ce63f0d5..8e94882ee2 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -155,7 +155,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java index ba375bafe7..f6178435d7 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java @@ -196,7 +196,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -521,7 +520,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java index fb689d0572..54b581d9c1 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java @@ -616,9 +616,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2087,17 +2084,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java index 9b5a683a98..a054cf35bc 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4180,11 +4180,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Player.java index a52f50c883..91d2b20461 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -120,7 +120,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -132,7 +131,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -737,8 +735,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1081,20 +1077,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10807,18 +10789,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13156,16 +13126,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/ExClientPackets.java index cf0c5c8464..bf06af02f5 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -194,9 +194,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini index 6aca958ad8..0ae1401032 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini @@ -599,28 +599,6 @@ AltBirthdayMailSubject = Happy Birthday! AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True - - # --------------------------------------------------------------------------- # Bot Report Button settings # --------------------------------------------------------------------------- diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java index cdc2c4f1c5..cbb02a274f 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -155,7 +155,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java index ba375bafe7..f6178435d7 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java @@ -196,7 +196,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -521,7 +520,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java index 0ddb4ad681..56f223da64 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java @@ -616,9 +616,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2129,17 +2126,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java index 99136e6bc6..832088028c 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4179,11 +4179,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Player.java index c24e80ab35..576ca52b85 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -122,7 +122,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager; @@ -135,7 +134,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -749,8 +747,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1100,20 +1096,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10766,18 +10748,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13188,16 +13158,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 58165a17fb..bc67d503f6 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -208,9 +208,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index f056c1947e..3d4121d7c9 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -83,7 +83,7 @@ public class ExTimedHuntingZoneEnter implements ClientPacket player.sendMessage("Cannot use time-limited hunting zones while waiting for the Olympiad."); return; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("Cannot use time-limited hunting zones while registered on an event."); return; diff --git a/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini b/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini index 2f14cf2f93..0011059ae8 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini @@ -630,26 +630,6 @@ AltBirthdayMailSubject = Happy Birthday! # $s1: Age AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True # --------------------------------------------------------------------------- # Bot Report Button settings diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java index e8d7394634..e9133e8c7e 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -152,7 +152,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java index c9e7d20fe4..95d5b7c20a 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java @@ -195,7 +195,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -519,7 +518,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java index 2c7d1862e5..02bd9e8cc4 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java @@ -623,9 +623,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2089,17 +2086,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 7541); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/enums/InstanceType.java index 8d4cb93edb..5511d9b5f9 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 7f6db4ec1c..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index d097482bf6..227edc8271 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4167,11 +4167,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java index 53c0d3dfe2..049ea5d891 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -115,7 +115,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; @@ -127,7 +126,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.CommandChannel; import org.l2jmobius.gameserver.model.ContactList; @@ -724,8 +722,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new loto ticket **/ private final int[] _loto = new int[5]; /** new race ticket **/ @@ -1053,20 +1049,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10769,18 +10751,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13099,16 +13069,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 1d15d2f653..9509c82f28 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -175,9 +175,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini index 5ea510fff3..db97b97ac0 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini @@ -599,28 +599,6 @@ AltBirthdayMailSubject = Happy Birthday! AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True - - # --------------------------------------------------------------------------- # Bot Report Button settings # --------------------------------------------------------------------------- diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java index fb5b15f7f6..5514083d73 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -156,7 +156,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java index 5109d3a52d..8788d7d455 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java @@ -197,7 +197,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -525,7 +524,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java index 1b75fc893c..faf83479ba 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java @@ -617,9 +617,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2168,17 +2165,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 93998); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 5efdf5da8e..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.YOU_HAVE_ALREADY_BEEN_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java index d939da4dcb..78fb832250 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4192,11 +4192,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Player.java index 1173eadec5..53a390cfba 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -124,7 +124,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager; @@ -137,7 +136,6 @@ import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -777,8 +775,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1133,20 +1129,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -10952,18 +10934,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13468,16 +13438,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 1e0231346f..c4b21ab83f 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -244,9 +244,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index 21cd4997cd..7fc2cede71 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -83,7 +83,7 @@ public class ExTimedHuntingZoneEnter implements ClientPacket player.sendMessage("Cannot use time-limited hunting zones while waiting for the Olympiad."); return; } - if (player.isOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isOnEvent()) { player.sendMessage("Cannot use time-limited hunting zones while registered on an event."); return; diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini index eae6e84de6..cf4b3e570c 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini @@ -599,28 +599,6 @@ AltBirthdayMailSubject = Happy Birthday! AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True - - # --------------------------------------------------------------------------- # Bot Report Button settings # --------------------------------------------------------------------------- diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java index c8cf2c31de..08e6133f02 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -156,7 +156,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java index 5109d3a52d..8788d7d455 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java @@ -197,7 +197,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -525,7 +524,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java index d5ec4eb943..bb1e05db97 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java @@ -620,9 +620,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2274,17 +2271,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 72078); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 5efdf5da8e..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.YOU_HAVE_ALREADY_BEEN_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java index b9fbf8b6aa..1687a772db 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4199,11 +4199,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Player.java index 34a5cb6f15..09e9b5cf2a 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -126,7 +126,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager; @@ -141,7 +140,6 @@ import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; import org.l2jmobius.gameserver.model.AchievementBox; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -802,8 +800,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1165,20 +1161,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -11109,18 +11091,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13636,16 +13606,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExClientPackets.java index 95e9d04736..9f009697a5 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -271,9 +271,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index 21cd4997cd..7fc2cede71 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -83,7 +83,7 @@ public class ExTimedHuntingZoneEnter implements ClientPacket player.sendMessage("Cannot use time-limited hunting zones while waiting for the Olympiad."); return; } - if (player.isOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isOnEvent()) { player.sendMessage("Cannot use time-limited hunting zones while registered on an event."); return; diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/General.ini b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/General.ini index 80fd67205b..4008c647e4 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/General.ini @@ -605,28 +605,6 @@ AltBirthdayMailSubject = Happy Birthday! AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True - - # --------------------------------------------------------------------------- # Bot Report Button settings # --------------------------------------------------------------------------- diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java index 869fe18c0a..a697a7da9f 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -158,7 +158,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java index 5109d3a52d..8788d7d455 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java @@ -197,7 +197,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -525,7 +524,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index 6aa32e39af..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 587f809dc9..6b0ff43990 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java index dc2c6a7993..2acaf11a12 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java @@ -624,9 +624,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2314,17 +2311,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 72078); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 6393c431b7..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_HAS_ALREADY_BEEN_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java index 336e0669ce..33bd255887 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4219,11 +4219,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Player.java index 0cce4d2542..ec94a40b7a 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -128,7 +128,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager; @@ -143,7 +142,6 @@ import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; import org.l2jmobius.gameserver.model.AchievementBox; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -819,8 +817,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1185,20 +1181,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -11371,18 +11353,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13933,16 +13903,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExClientPackets.java index b93ce886b2..8363331dd9 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -313,9 +313,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index f418d2dc4c..c9b656fb6b 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -83,7 +83,7 @@ public class ExTimedHuntingZoneEnter implements ClientPacket player.sendMessage("Cannot use time-limited hunting zones while waiting for the Olympiad."); return; } - if (player.isOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isOnEvent()) { player.sendMessage("Cannot use time-limited hunting zones while registered on an event."); return; diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/config/General.ini b/L2J_Mobius_Essence_6.3_Crusader/dist/game/config/General.ini index 80fd67205b..4008c647e4 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/config/General.ini @@ -605,28 +605,6 @@ AltBirthdayMailSubject = Happy Birthday! AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria -# --------------------------------------------------------------------------- -# Handy's Block Checker Event Settings -# --------------------------------------------------------------------------- - -# Enable the Handy's Block Checker event -# Classic: False -EnableBlockCheckerEvent = False - -# Minimum number of members on each team before -# be able to start the event -# Min: 1 -# Max: 6 -# Retail: 2 -BlockCheckerMinTeamMembers = 2 - -# Fair play -# Players can choose what team to play. However, by -# enabling this property to true, the teams will be -# balanced in the teleport to the arena -HBCEFairPlay = True - - # --------------------------------------------------------------------------- # Bot Report Button settings # --------------------------------------------------------------------------- diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java index f292c2d6d1..c8d647b1df 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java +++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/custom/events/TeamVsTeam/TvT.java @@ -658,7 +658,7 @@ public class TvT extends Event player.sendMessage("Your level is too high to participate."); return false; } - if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isRegisteredOnEvent()) { player.sendMessage("You are already registered on an event."); return false; diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java index 869fe18c0a..a697a7da9f 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -158,7 +158,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("FishingExpSpBonus", FishingExpSpBonus::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new); - EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new); EffectHandler.getInstance().registerHandler("FocusMaxMomentum", FocusMaxMomentum::new); diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/MasterHandler.java index 5109d3a52d..8788d7d455 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/MasterHandler.java @@ -197,7 +197,6 @@ import handlers.itemhandlers.CharmOfCourage; import handlers.itemhandlers.Elixir; import handlers.itemhandlers.EnchantAttribute; import handlers.itemhandlers.EnchantScrolls; -import handlers.itemhandlers.EventItem; import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.FatedSupportBox; import handlers.itemhandlers.FishShots; @@ -525,7 +524,6 @@ public class MasterHandler Elixir.class, EnchantAttribute.class, EnchantScrolls.class, - EventItem.class, ExtractableItems.class, FatedSupportBox.class, FishShots.class, diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java deleted file mode 100644 index d6ec9a1063..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/FlipBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; - -/** - * Flip Block effect implementation. - * @author Mobius - */ -public class FlipBlock extends AbstractEffect -{ - public FlipBlock(StatSet params) - { - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, Item item) - { - final Block block = effected instanceof Block ? (Block) effected : null; - final Player player = effector.isPlayer() ? (Player) effector : null; - if ((block == null) || (player == null)) - { - return; - } - - final int arena = player.getBlockCheckerArena(); - if (arena != -1) - { - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); - if (holder == null) - { - return; - } - - final int team = holder.getPlayerTeam(player); - final int color = block.getColorEffect(); - if ((team == 0) && (color == 0x00)) - { - block.changeColor(player, holder, team); - } - else if ((team == 1) && (color == 0x53)) - { - block.changeColor(player, holder, team); - } - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/EventItem.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/EventItem.java deleted file mode 100644 index da8c4fc94a..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/EventItem.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.itemhandlers; - -import org.l2jmobius.gameserver.enums.ItemSkillType; -import org.l2jmobius.gameserver.handler.IItemHandler; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Playable; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -public class EventItem implements IItemHandler -{ - @Override - public boolean useItem(Playable playable, Item item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - boolean used = false; - - final Player player = playable.getActingPlayer(); - final int itemId = item.getId(); - switch (itemId) - { - case 13787: // Handy's Block Checker Bond - { - used = useBlockCheckerItem(player, item); - break; - } - case 13788: // Handy's Block Checker Land Mine - { - used = useBlockCheckerItem(player, item); - break; - } - default: - { - LOGGER.warning("EventItemHandler: Item with id: " + itemId + " is not handled"); - } - } - return used; - } - - private final boolean useBlockCheckerItem(Player castor, Item item) - { - final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.S1_THE_FUNCTION_CANNOT_BE_USED_AS_CERTAIN_REQUIREMENTS_ARE_NOT_MET); - msg.addItemName(item); - castor.sendPacket(msg); - return false; - } - - final Skill sk = item.getEtcItem().getSkills(ItemSkillType.NORMAL).get(0).getSkill(); - if (sk == null) - { - return false; - } - - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { - return false; - } - - final Block block = (Block) castor.getTarget(); - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { - final int team = holder.getPlayerTeam(castor); - World.getInstance().forEachVisibleObjectInRange(block, Player.class, sk.getEffectRange(), pc -> - { - final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { - sk.applyEffects(castor, pc); - } - }); - return true; - } - LOGGER.warning("Char: " + castor.getName() + "[" + castor.getObjectId() + "] has unknown block checker arena"); - return false; - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java index 15713bda82..978d8a73f1 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java +++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/itemhandlers/SummonItems.java @@ -39,7 +39,7 @@ public class SummonItems extends ItemSkillsTemplate } final Player player = playable.getActingPlayer(); - if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || (player.getBlockCheckerArena() != -1) || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) + if (!player.getClient().getFloodProtectors().canUsePetSummonItem() || player.inObserverMode() || player.isAllSkillsDisabled() || player.isCastingNow()) { return false; } diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/Config.java index dc2c6a7993..2acaf11a12 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/Config.java @@ -624,9 +624,6 @@ public class Config public static int ALT_BIRTHDAY_GIFT; public static String ALT_BIRTHDAY_MAIL_SUBJECT; public static String ALT_BIRTHDAY_MAIL_TEXT; - public static boolean ENABLE_BLOCK_CHECKER_EVENT; - public static int MIN_BLOCK_CHECKER_TEAM_MEMBERS; - public static boolean HBCE_FAIR_PLAY; public static int PLAYER_MOVEMENT_BLOCK_TIME; public static int ABILITY_MAX_POINTS; public static long ABILITY_POINTS_RESET_ADENA; @@ -2314,17 +2311,6 @@ public class Config ALT_BIRTHDAY_GIFT = generalConfig.getInt("AltBirthdayGift", 72078); ALT_BIRTHDAY_MAIL_SUBJECT = generalConfig.getString("AltBirthdayMailSubject", "Happy Birthday!"); ALT_BIRTHDAY_MAIL_TEXT = generalConfig.getString("AltBirthdayMailText", "Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day." + EOL + EOL + "Sincerely, Alegria"); - ENABLE_BLOCK_CHECKER_EVENT = generalConfig.getBoolean("EnableBlockCheckerEvent", false); - MIN_BLOCK_CHECKER_TEAM_MEMBERS = generalConfig.getInt("BlockCheckerMinTeamMembers", 2); - if (MIN_BLOCK_CHECKER_TEAM_MEMBERS < 1) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 1; - } - else if (MIN_BLOCK_CHECKER_TEAM_MEMBERS > 6) - { - MIN_BLOCK_CHECKER_TEAM_MEMBERS = 6; - } - HBCE_FAIR_PLAY = generalConfig.getBoolean("HBCEFairPlay", false); BOTREPORT_ENABLE = generalConfig.getBoolean("EnableBotReportButton", false); BOTREPORT_RESETPOINT_HOUR = generalConfig.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_REPORT_DELAY = generalConfig.getInt("BotReportDelay", 30) * 60000; diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/enums/InstanceType.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/enums/InstanceType.java index f44949bbf4..10b5dd6f52 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/enums/InstanceType.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/enums/InstanceType.java @@ -42,7 +42,6 @@ public enum InstanceType Attackable(Npc), Guard(Attackable), Monster(Attackable), - Block(Attackable), Chest(Monster), ControllableMob(Monster), FeedableBeast(Monster), diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java deleted file mode 100644 index 6393c431b7..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class manage the player add/remove, team change and event arena status,
- * as the clearance of the participants list or liberate the arena. - * @author BiggBoss - */ -public class HandysBlockCheckerManager -{ - // All the participants and their team classified by arena - private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4]; - - // Arena votes to start the game - private static final Map _arenaVotes = new HashMap<>(); - - // Arena Status, True = is being used, otherwise, False - private static final Map _arenaStatus = new HashMap<>(); - - // Registration request penalty (10 seconds) - protected static Set _registrationPenalty = Collections.synchronizedSet(new HashSet<>()); - - /** - * Return the number of event-start votes for the specified arena id - * @param arenaId - * @return int (number of votes) - */ - public synchronized int getArenaVotes(int arenaId) - { - return _arenaVotes.get(arenaId); - } - - /** - * Add a new vote to start the event for the specified arena id - * @param arena - */ - public synchronized void increaseArenaVotes(int arena) - { - final int newVotes = _arenaVotes.get(arena) + 1; - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted()) - { - clearArenaVotes(arena); - if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0)) - { - return; - } - if (Config.HBCE_FAIR_PLAY) - { - holder.checkAndShuffle(); - } - ThreadPool.execute(holder.getEvent().new StartEvent()); - } - else - { - _arenaVotes.put(arena, newVotes); - } - } - - /** - * Will clear the votes queue (of event start) for the specified arena id - * @param arena - */ - public synchronized void clearArenaVotes(int arena) - { - _arenaVotes.put(arena, 0); - } - - protected HandysBlockCheckerManager() - { - // Initialize arena status - _arenaStatus.put(0, false); - _arenaStatus.put(1, false); - _arenaStatus.put(2, false); - _arenaStatus.put(3, false); - - // Initialize arena votes - _arenaVotes.put(0, 0); - _arenaVotes.put(1, 0); - _arenaVotes.put(2, 0); - _arenaVotes.put(3, 0); - } - - /** - * Returns the players holder - * @param arena - * @return ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder(int arena) - { - return _arenaPlayers[arena]; - } - - /** - * Initializes the participants holder - */ - public void startUpParticipantsQueue() - { - for (int i = 0; i < 4; ++i) - { - _arenaPlayers[i] = new ArenaParticipantsHolder(i); - } - } - - /** - * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets - * @param player - * @param arenaId - * @return - */ - public boolean addPlayerToArena(Player player, int arenaId) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - - synchronized (holder) - { - boolean isRed; - for (int i = 0; i < 4; i++) - { - if (_arenaPlayers[i].getAllPlayers().contains(player)) - { - final SystemMessage msg = new SystemMessage(SystemMessageId.C1_HAS_ALREADY_BEEN_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addString(player.getName()); - player.sendPacket(msg); - return false; - } - } - - if (player.isCursedWeaponEquipped()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON); - return false; - } - - if (player.isRegisteredOnEvent() || player.isInOlympiadMode()) - { - player.sendMessage("Couldnt register you due other event participation."); - return false; - } - - if (OlympiadManager.getInstance().isRegistered(player)) - { - OlympiadManager.getInstance().unRegisterNoble(player); - player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER); - } - - // if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player)) - // { - // UngerGroundColiseum.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - // if(KrateiCubeManager.getInstance().isRegisteredPlayer(player)) - // { - // KrateiCubeManager.getInstance().removeParticipant(player); - // player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER)); - // } - if (_registrationPenalty.contains(player.getObjectId())) - { - player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN); - return false; - } - - if (holder.getBlueTeamSize() < holder.getRedTeamSize()) - { - holder.addPlayer(player, 1); - isRed = false; - } - else - { - holder.addPlayer(player, 0); - isRed = true; - } - holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed)); - return true; - } - } - - /** - * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates - * @param player - * @param arenaId - * @param team - */ - public void removePlayer(Player player, int arenaId, int team) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arenaId]; - synchronized (holder) - { - final boolean isRed = team == 0; - holder.removePlayer(player, team); - holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed)); - - // End event if theres an empty team - final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize(); - if (teamSize == 0) - { - holder.getEvent().endEventAbnormally(); - } - - _registrationPenalty.add(player.getObjectId()); - schedulePenaltyRemoval(player.getObjectId()); - } - } - - /** - * Will change the player from one team to other (if possible) and will send the needed packets - * @param player - * @param arena - */ - public void changePlayerToTeam(Player player, int arena) - { - final ArenaParticipantsHolder holder = _arenaPlayers[arena]; - - synchronized (holder) - { - final boolean isFromRed = holder.getRedPlayers().contains(player); - if (isFromRed && (holder.getBlueTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - else if (!isFromRed && (holder.getRedTeamSize() == 6)) - { - player.sendMessage("The team is full"); - return; - } - - final int futureTeam = isFromRed ? 1 : 0; - holder.addPlayer(player, futureTeam); - if (isFromRed) - { - holder.removePlayer(player, 0); - } - else - { - holder.removePlayer(player, 1); - } - holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed)); - } - } - - /** - * Will erase all participants from the specified holder - * @param arenaId - */ - public synchronized void clearPaticipantQueueByArenaId(int arenaId) - { - _arenaPlayers[arenaId].clearPlayers(); - } - - /** - * Returns true if arena is holding an event at this momment - * @param arenaId - * @return boolean - */ - public boolean arenaIsBeingUsed(int arenaId) - { - if ((arenaId < 0) || (arenaId > 3)) - { - return false; - } - return _arenaStatus.get(arenaId); - } - - /** - * Set the specified arena as being used - * @param arenaId - */ - public void setArenaBeingUsed(int arenaId) - { - _arenaStatus.put(arenaId, true); - } - - /** - * Set as free the specified arena for future events - * @param arenaId - */ - public void setArenaFree(int arenaId) - { - _arenaStatus.put(arenaId, false); - } - - /** - * Called when played logs out while participating in Block Checker Event - * @param player - */ - public void onDisconnect(Player player) - { - final int arena = player.getBlockCheckerArena(); - final int team = getHolder(arena).getPlayerTeam(player); - getInstance().removePlayer(player, arena, team); - if (player.getTeam() != Team.NONE) - { - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); - } - if (inv.getItemByItemId(13788) != null) - { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); - } - player.setInsideZone(ZoneId.PVP, false); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - } - } - - public void removePenalty(int objectId) - { - _registrationPenalty.remove(objectId); - } - - private void schedulePenaltyRemoval(int objId) - { - ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000); - } - - /** - * Gets the single instance of {@code HandysBlockCheckerManager}. - * @return single instance of {@code HandysBlockCheckerManager} - */ - public static HandysBlockCheckerManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final HandysBlockCheckerManager INSTANCE = new HandysBlockCheckerManager(); - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java deleted file mode 100644 index dbe4969dba..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/games/BlockChecker.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.games; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.SpawnTable; -import org.l2jmobius.gameserver.data.xml.NpcData; -import org.l2jmobius.gameserver.data.xml.SkillData; -import org.l2jmobius.gameserver.enums.Team; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.Spawn; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.Summon; -import org.l2jmobius.gameserver.model.actor.instance.Block; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; -import org.l2jmobius.gameserver.model.skill.Skill; -import org.l2jmobius.gameserver.model.zone.ZoneId; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameCloseUI; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameEnd; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.RelationChanged; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author BiggBoss - */ -public class BlockChecker -{ - protected static final Logger LOGGER = Logger.getLogger(BlockChecker.class.getName()); - // The object which holds all basic members info - protected ArenaParticipantsHolder _holder; - // Maps to hold player of each team and his points - protected Map _redTeamPoints = new ConcurrentHashMap<>(); - protected Map _blueTeamPoints = new ConcurrentHashMap<>(); - // The initial points of the event - protected int _redPoints = 15; - protected int _bluePoints = 15; - // Current used arena - protected int _arena = -1; - // All blocks - protected Set _spawns = ConcurrentHashMap.newKeySet(); - // Sets if the red team won the event at the end of this (used for packets) - protected boolean _isRedWinner; - // Time when the event starts. Used on packet sending - protected long _startedTime; - // The needed arena coordinates - // Arena X: team1X, team1Y, team2X, team2Y, ArenaCenterX, ArenaCenterY - protected static final int[][] _arenaCoordinates = - { - // Arena 0 - Team 1 XY, Team 2 XY - CENTER XY - { - -58368, - -62745, - -57751, - -62131, - -58053, - -62417 - }, - // Arena 1 - Team 1 XY, Team 2 XY - CENTER XY - { - -58350, - -63853, - -57756, - -63266, - -58053, - -63551 - }, - // Arena 2 - Team 1 XY, Team 2 XY - CENTER XY - { - -57194, - -63861, - -56580, - -63249, - -56886, - -63551 - }, - // Arena 3 - Team 1 XY, Team 2 XY - CENTER XY - { - -57200, - -62727, - -56584, - -62115, - -56850, - -62391 - } - }; - // Common z coordinate - private static final int Z_COORD = -2405; - // List of dropped items in event (for later deletion) - protected Set _drops = ConcurrentHashMap.newKeySet(); - // Default arena - private static final byte DEFAULT_ARENA = -1; - // Event is started - protected boolean _isStarted = false; - // Event end - protected ScheduledFuture _task; - // Preserve from exploit reward by logging out - protected boolean _abnormalEnd = false; - - public BlockChecker(ArenaParticipantsHolder holder, int arena) - { - _holder = holder; - if ((arena > -1) && (arena < 4)) - { - _arena = arena; - } - - for (Player player : holder.getRedPlayers()) - { - _redTeamPoints.put(player, 0); - } - for (Player player : holder.getBluePlayers()) - { - _blueTeamPoints.put(player, 0); - } - } - - /** - * Updates the player holder before the event starts to synchronize all info - * @param holder - */ - public void updatePlayersOnStart(ArenaParticipantsHolder holder) - { - _holder = holder; - } - - /** - * Returns the current holder object of this object engine - * @return HandysBlockCheckerManager.ArenaParticipantsHolder - */ - public ArenaParticipantsHolder getHolder() - { - return _holder; - } - - /** - * Will return the id of the arena used by this event - * @return false; - */ - public int getArena() - { - return _arena; - } - - /** - * Returns the time when the event started - * @return long - */ - public long getStarterTime() - { - return _startedTime; - } - - /** - * Returns the current red team points - * @return int - */ - public int getRedPoints() - { - synchronized (this) - { - return _redPoints; - } - } - - /** - * Returns the current blue team points - * @return int - */ - public int getBluePoints() - { - synchronized (this) - { - return _bluePoints; - } - } - - /** - * Returns the player points - * @param player - * @param isRed - * @return int - */ - public int getPlayerPoints(Player player, boolean isRed) - { - if (!_redTeamPoints.containsKey(player) && !_blueTeamPoints.containsKey(player)) - { - return 0; - } - - if (isRed) - { - return _redTeamPoints.get(player); - } - return _blueTeamPoints.get(player); - } - - /** - * Increases player points for his teams - * @param player - * @param team - */ - public synchronized void increasePlayerPoints(Player player, int team) - { - if (player == null) - { - return; - } - - if (team == 0) - { - final int points = _redTeamPoints.get(player) + 1; - _redTeamPoints.put(player, points); - _redPoints++; - _bluePoints--; - } - else - { - final int points = _blueTeamPoints.get(player) + 1; - _blueTeamPoints.put(player, points); - _bluePoints++; - _redPoints--; - } - } - - /** - * Will add a new drop into the list of dropped items - * @param item - */ - public void addNewDrop(Item item) - { - if (item != null) - { - _drops.add(item); - } - } - - /** - * Will return true if the event is already started - * @return boolean - */ - public boolean isStarted() - { - return _isStarted; - } - - /** - * Will send all packets for the event members with the relation info - * @param plr - */ - protected void broadcastRelationChanged(Player plr) - { - for (Player p : _holder.getAllPlayers()) - { - p.sendPacket(new RelationChanged(plr, plr.getRelation(p), plr.isAutoAttackable(p))); - } - } - - /** - * Called when a there is an empty team. The event will end. - */ - public void endEventAbnormally() - { - try - { - synchronized (this) - { - _isStarted = false; - if (_task != null) - { - _task.cancel(true); - } - - _abnormalEnd = true; - ThreadPool.execute(new EndEvent()); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "Couldnt end Block Checker event at " + _arena, e); - } - } - - /** - * This inner class set ups all player and arena parameters to start the event - */ - public class StartEvent implements Runnable - { - // In event used skills - private final Skill _freeze; - private final Skill _transformationRed; - private final Skill _transformationBlue; - // Common and unparametizer packet - private final ExCubeGameCloseUI _closeUserInterface = ExCubeGameCloseUI.STATIC_PACKET; - - public StartEvent() - { - // Initialize all used skills - _freeze = SkillData.getInstance().getSkill(6034, 1); - _transformationRed = SkillData.getInstance().getSkill(6035, 1); - _transformationBlue = SkillData.getInstance().getSkill(6036, 1); - } - - /** - * Will set up all player parameters and port them to their respective location based on their teams - */ - private void setUpPlayers() - { - // Set current arena as being used - HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena); - - // Initialize packets avoiding create a new one per player - _redPoints = _spawns.size() / 2; - _bluePoints = _spawns.size() / 2; - final ExCubeGameChangePoints initialPoints = new ExCubeGameChangePoints(300, _bluePoints, _redPoints); - ExCubeGameExtendedChangePoints clientSetUp; - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - // Send the secret client packet set up - final boolean isRed = _holder.getRedPlayers().contains(player); - clientSetUp = new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0); - player.sendPacket(clientSetUp); - - player.sendPacket(ActionFailed.STATIC_PACKET); - - // Teleport Player - Array access - // Team 0 * 2 = 0; 0 = 0, 0 + 1 = 1. - // Team 1 * 2 = 2; 2 = 2, 2 + 1 = 3 - final int tc = _holder.getPlayerTeam(player) * 2; - // Get x and y coordinates - final int x = _arenaCoordinates[_arena][tc]; - final int y = _arenaCoordinates[_arena][tc + 1]; - player.teleToLocation(x, y, Z_COORD); - // Set the player team - if (isRed) - { - _redTeamPoints.put(player, 0); - player.setTeam(Team.RED); - } - else - { - _blueTeamPoints.put(player, 0); - player.setTeam(Team.BLUE); - } - player.stopAllEffects(); - final Summon pet = player.getPet(); - if (pet != null) - { - pet.unSummon(player); - } - player.getServitors().values().forEach(s -> s.unSummon(player)); - - // Give the player start up effects - // Freeze - _freeze.applyEffects(player, player); - // Transformation - if (_holder.getPlayerTeam(player) == 0) - { - _transformationRed.applyEffects(player, player); - } - else - { - _transformationBlue.applyEffects(player, player); - } - // Set the current player arena - player.setBlockCheckerArena((byte) _arena); - player.setInsideZone(ZoneId.PVP, true); - // Send needed packets - player.sendPacket(initialPoints); - player.sendPacket(_closeUserInterface); - // ExBasicActionList - player.sendPacket(ExBasicActionList.STATIC_PACKET); - broadcastRelationChanged(player); - } - } - - @Override - public void run() - { - // Wrong arena passed, stop event - if (_arena == -1) - { - LOGGER.severe("Couldnt set up the arena Id for the Block Checker event, cancelling event..."); - return; - } - _isStarted = true; - // Spawn the blocks - ThreadPool.execute(new SpawnRound(16, 1)); - // Start up player parameters - setUpPlayers(); - // Set the started time - _startedTime = System.currentTimeMillis() + 300000; - } - } - - /** - * This class spawns the second round of boxes and schedules the event end - */ - private class SpawnRound implements Runnable - { - int _numOfBoxes; - int _round; - - SpawnRound(int numberOfBoxes, int round) - { - _numOfBoxes = numberOfBoxes; - _round = round; - } - - @Override - public void run() - { - if (!_isStarted) - { - return; - } - - switch (_round) - { - case 1: // Schedule second spawn round - { - _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); - break; - } - case 2: // Schedule third spawn round - { - _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); - break; - } - case 3: // Schedule Event End Count Down - { - _task = ThreadPool.schedule(new EndEvent(), 180000); - break; - } - } - // random % 2, if == 0 will spawn a red block - // if != 0, will spawn a blue block - byte random = 2; - // common template - final NpcTemplate template = NpcData.getInstance().getTemplate(18672); - // Spawn blocks - try - { - // Creates 50 new blocks - for (int i = 0; i < _numOfBoxes; i++) - { - final Spawn spawn = new Spawn(template); - spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - spawn.setAmount(1); - spawn.setHeading(1); - spawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(spawn, false); - spawn.init(); - final Block block = (Block) spawn.getLastSpawn(); - // switch color - block.setRed((random % 2) == 0); - block.disableCoreAI(true); - _spawns.add(spawn); - random++; - } - } - catch (Exception e) - { - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - - // Spawn the block carrying girl - if ((_round == 1) || (_round == 2)) - { - try - { - final Spawn girlSpawn = new Spawn(18676); - girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), Z_COORD); - girlSpawn.setAmount(1); - girlSpawn.setHeading(1); - girlSpawn.setRespawnDelay(1); - SpawnTable.getInstance().addNewSpawn(girlSpawn, false); - girlSpawn.init(); - // Schedule his deletion after 9 secs of spawn - ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); - } - catch (Exception e) - { - LOGGER.warning("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?"); - LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage()); - } - } - - _redPoints += _numOfBoxes / 2; - _bluePoints += _numOfBoxes / 2; - - final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); - _holder.broadCastPacketToTeam(changePoints); - } - } - - private class CarryingGirlUnspawn implements Runnable - { - private final Spawn _spawn; - - protected CarryingGirlUnspawn(Spawn spawn) - { - _spawn = spawn; - } - - @Override - public void run() - { - if (_spawn == null) - { - LOGGER.warning("HBCE: Block Carrying Girl is null"); - return; - } - SpawnTable.getInstance().deleteSpawn(_spawn, false); - _spawn.stopRespawn(); - _spawn.getLastSpawn().deleteMe(); - } - } - - /* - * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(new SystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } - */ - - /** - * This class erase all event parameters on player and port them back near Handy. Also, unspawn blocks, runs a garbage collector and set as free the used arena - */ - protected class EndEvent implements Runnable - { - // Garbage collector and arena free setter - private void clearMe() - { - HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); - _holder.clearPlayers(); - _blueTeamPoints.clear(); - _redTeamPoints.clear(); - HandysBlockCheckerManager.getInstance().setArenaFree(_arena); - - for (Spawn spawn : _spawns) - { - spawn.stopRespawn(); - spawn.getLastSpawn().deleteMe(); - SpawnTable.getInstance().deleteSpawn(spawn, false); - } - _spawns.clear(); - - for (Item item : _drops) - { - // npe - if (item == null) - { - continue; - } - - // a player has it, it will be deleted later - if (!item.isSpawned() || (item.getOwnerId() != 0)) - { - continue; - } - - item.decayMe(); - } - _drops.clear(); - } - - /** - * Reward players after event. Tie - No Reward - */ - private void rewardPlayers() - { - if (_redPoints == _bluePoints) - { - return; - } - - _isRedWinner = _redPoints > _bluePoints; - if (_isRedWinner) - { - rewardAsWinner(true); - rewardAsLooser(false); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Red Team"); - _holder.broadCastPacketToTeam(msg); - } - else if (_bluePoints > _redPoints) - { - rewardAsWinner(false); - rewardAsLooser(true); - final SystemMessage msg = new SystemMessage(SystemMessageId.THE_C1_TEAM_HAS_WON); - msg.addString("Blue Team"); - _holder.broadCastPacketToTeam(msg); - } - else - { - rewardAsLooser(true); - rewardAsLooser(false); - } - } - - /** - * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra - * @param isRed - */ - private void rewardAsWinner(boolean isRed) - { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - - // Main give - for (Entry points : tempPoints.entrySet()) - { - if (points.getKey() == null) - { - continue; - } - - if (points.getValue() >= 10) - { - points.getKey().addItem("Block Checker", 13067, 2, points.getKey(), true); - } - else - { - tempPoints.remove(points.getKey()); - } - } - - int first = 0; - int second = 0; - Player winner1 = null; - Player winner2 = null; - for (Entry entry : tempPoints.entrySet()) - { - final Player pc = entry.getKey(); - final int pcPoints = entry.getValue(); - if (pcPoints > first) - { - // Move old data - second = first; - winner2 = winner1; - // Set new data - first = pcPoints; - winner1 = pc; - } - else if (pcPoints > second) - { - second = pcPoints; - winner2 = pc; - } - } - if (winner1 != null) - { - winner1.addItem("Block Checker", 13067, 8, winner1, true); - } - if (winner2 != null) - { - winner2.addItem("Block Checker", 13067, 5, winner2, true); - } - } - - /** - * Will reward the looser team with the predefined rewards Player got >= 10 points: 2 coins Player got < 10 points: 0 coins - * @param isRed - */ - private void rewardAsLooser(boolean isRed) - { - for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) - { - final Player player = entry.getKey(); - if ((player != null) && (entry.getValue() >= 10)) - { - player.addItem("Block Checker", 13067, 2, player, true); - } - } - } - - /** - * Teleport players back, give status back and send final packet - */ - private void setPlayersBack() - { - final ExCubeGameEnd end = new ExCubeGameEnd(_isRedWinner); - for (Player player : _holder.getAllPlayers()) - { - if (player == null) - { - continue; - } - - player.stopAllEffects(); - // Remove team aura - player.setTeam(Team.NONE); - // Set default arena - player.setBlockCheckerArena(DEFAULT_ARENA); - // Remove the event items - final PlayerInventory inv = player.getInventory(); - if (inv.getItemByItemId(13787) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); - } - if (inv.getItemByItemId(13788) != null) - { - inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); - } - broadcastRelationChanged(player); - // Teleport Back - player.teleToLocation(-57478, -60367, -2370); - player.setInsideZone(ZoneId.PVP, false); - // Send end packet - player.sendPacket(end); - player.broadcastUserInfo(); - } - } - - @Override - public void run() - { - if (!_abnormalEnd) - { - rewardPlayers(); - } - setPlayersBack(); - clearMe(); - _isStarted = false; - _abnormalEnd = false; - } - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java deleted file mode 100644 index 7735e8895a..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/tasks/PenaltyRemoveTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.instancemanager.tasks; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; - -/** - * Handys Block Checker penalty remove. - * @author xban1x - */ -public class PenaltyRemoveTask implements Runnable -{ - private final int _objectId; - - public PenaltyRemoveTask(int id) - { - _objectId = id; - } - - @Override - public void run() - { - HandysBlockCheckerManager.getInstance().removePenalty(_objectId); - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java deleted file mode 100644 index 01d8cb274d..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/ArenaParticipantsHolder.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.ServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * @author xban1x - */ -public class ArenaParticipantsHolder -{ - private final int _arena; - private final List _redPlayers; - private final List _bluePlayers; - private final BlockChecker _engine; - - public ArenaParticipantsHolder(int arena) - { - _arena = arena; - _redPlayers = new ArrayList<>(6); - _bluePlayers = new ArrayList<>(6); - _engine = new BlockChecker(this, _arena); - } - - public List getRedPlayers() - { - return _redPlayers; - } - - public List getBluePlayers() - { - return _bluePlayers; - } - - public List getAllPlayers() - { - final List all = new ArrayList<>(12); - all.addAll(_redPlayers); - all.addAll(_bluePlayers); - return all; - } - - public void addPlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.add(player); - } - else - { - _bluePlayers.add(player); - } - } - - public void removePlayer(Player player, int team) - { - if (team == 0) - { - _redPlayers.remove(player); - } - else - { - _bluePlayers.remove(player); - } - } - - public int getPlayerTeam(Player player) - { - if (_redPlayers.contains(player)) - { - return 0; - } - else if (_bluePlayers.contains(player)) - { - return 1; - } - else - { - return -1; - } - } - - public int getRedTeamSize() - { - return _redPlayers.size(); - } - - public int getBlueTeamSize() - { - return _bluePlayers.size(); - } - - public void broadCastPacketToTeam(ServerPacket packet) - { - for (Player p : _redPlayers) - { - p.sendPacket(packet); - } - for (Player p : _bluePlayers) - { - p.sendPacket(packet); - } - } - - public void clearPlayers() - { - _redPlayers.clear(); - _bluePlayers.clear(); - } - - public BlockChecker getEvent() - { - return _engine; - } - - public void updateEvent() - { - _engine.updatePlayersOnStart(this); - } - - public void checkAndShuffle() - { - final int redSize = _redPlayers.size(); - final int blueSize = _bluePlayers.size(); - if (redSize > (blueSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = redSize - (blueSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _redPlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - else if (blueSize > (redSize + 1)) - { - broadCastPacketToTeam(new SystemMessage(SystemMessageId.TEAM_MEMBERS_WERE_MODIFIED_BECAUSE_THE_TEAMS_WERE_UNBALANCED)); - final int needed = blueSize - (redSize + 1); - for (int i = 0; i < (needed + 1); i++) - { - final Player plr = _bluePlayers.get(i); - if (plr == null) - { - continue; - } - HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena); - } - } - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java index 553c173da9..8f2b47b643 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4219,11 +4219,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe player.sendPacket(ActionFailed.STATIC_PACKET); return; } - if (player.getBlockCheckerArena() != -1) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - return; - } // Notify AI with AI_INTENTION_ATTACK player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this); } diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Player.java index d813380844..2376d7a4b4 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Player.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/Player.java @@ -128,7 +128,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.DuelManager; import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; import org.l2jmobius.gameserver.instancemanager.IdManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager; @@ -143,7 +142,6 @@ import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; import org.l2jmobius.gameserver.model.AccessLevel; import org.l2jmobius.gameserver.model.AchievementBox; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.ClientSettings; import org.l2jmobius.gameserver.model.CommandChannel; @@ -819,8 +817,6 @@ public class Player extends Playable private boolean _isOnSoloEvent = false; private boolean _isOnEvent = false; - private byte _handysBlockCheckerEventArena = -1; - /** new race ticket **/ private final int[] _race = new int[2]; @@ -1185,20 +1181,6 @@ public class Player extends Playable } } } - if (_handysBlockCheckerEventArena != -1) - { - result |= RelationChanged.RELATION_INSIEGE; - final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(getBlockCheckerArena()); - if (holder.getPlayerTeam(this) == 0) - { - result |= RelationChanged.RELATION_ENEMY; - } - else - { - result |= RelationChanged.RELATION_ALLY; - } - result |= RelationChanged.RELATION_ATTACKER; - } return result; } @@ -11371,18 +11353,6 @@ public class Player extends Playable LOGGER.log(Level.SEVERE, "deleteMe()", e); } - try - { - if (Config.ENABLE_BLOCK_CHECKER_EVENT && (_handysBlockCheckerEventArena != -1)) - { - HandysBlockCheckerManager.getInstance().onDisconnect(this); - } - } - catch (Exception e) - { - LOGGER.log(Level.SEVERE, "deleteMe()", e); - } - try { _isOnline = false; @@ -13933,16 +13903,6 @@ public class Player extends Playable return _isOnEvent || isAffected(EffectFlag.PROTECT_DEATH_PENALTY); } - public void setBlockCheckerArena(byte arena) - { - _handysBlockCheckerEventArena = arena; - } - - public int getBlockCheckerArena() - { - return _handysBlockCheckerEventArena; - } - public void setOriginalCpHpMp(double cp, double hp, double mp) { _originalCp = cp; diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/instance/Block.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/instance/Block.java deleted file mode 100644 index ce5be97e17..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/model/actor/instance/Block.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import org.l2jmobius.commons.util.Rnd; -import org.l2jmobius.gameserver.data.ItemTable; -import org.l2jmobius.gameserver.instancemanager.games.BlockChecker; -import org.l2jmobius.gameserver.model.ArenaParticipantsHolder; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.item.instance.Item; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.ExCubeGameExtendedChangePoints; -import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; - -/** - * @author BiggBoss - */ -public class Block extends Monster -{ - private int _colorEffect; - - public Block(NpcTemplate template) - { - super(template); - } - - /** - * Will change the color of the block and update the appearance in the known players clients - * @param attacker - * @param holder - * @param team - */ - public void changeColor(Player attacker, ArenaParticipantsHolder holder, int team) - { - // Do not update color while sending old info - synchronized (this) - { - final BlockChecker event = holder.getEvent(); - if (_colorEffect == 0x53) - { - // Change color - _colorEffect = 0x00; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - else - { - // Change color - _colorEffect = 0x53; - // BroadCast to all known players - broadcastPacket(new NpcInfo(this)); - increaseTeamPointsAndSend(attacker, team, event); - } - // 30% chance to drop the event items - final int random = Rnd.get(100); - // Bond - if ((random > 69) && (random <= 84)) - { - dropItem(13787, event, attacker); - } - else if (random > 84) - { - dropItem(13788, event, attacker); - } - } - } - - /** - * Sets if the block is red or blue. Mainly used in block spawn - * @param isRed - */ - public void setRed(boolean isRed) - { - _colorEffect = isRed ? 0x53 : 0x00; - } - - /** - * @return {@code true} if the block is red at this moment, {@code false} otherwise - */ - @Override - public int getColorEffect() - { - return _colorEffect; - } - - @Override - public boolean isAutoAttackable(Creature attacker) - { - if (attacker.isPlayer()) - { - return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1); - } - return true; - } - - @Override - public boolean doDie(Creature killer) - { - return false; - } - - @Override - public void onAction(Player player, boolean interact) - { - if (!canTarget(player)) - { - return; - } - - player.setLastFolkNPC(this); - - if (player.getTarget() != this) - { - player.setTarget(this); - getAI(); // wake up ai - } - else if (interact) - { - player.sendPacket(ActionFailed.STATIC_PACKET); - } - } - - private void increaseTeamPointsAndSend(Player player, int team, BlockChecker eng) - { - eng.increasePlayerPoints(player, team); - - final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000); - final boolean isRed = eng.getHolder().getRedPlayers().contains(player); - final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints()); - final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed)); - eng.getHolder().broadCastPacketToTeam(changePoints); - eng.getHolder().broadCastPacketToTeam(secretPoints); - } - - private void dropItem(int id, BlockChecker eng, Player player) - { - final Item drop = ItemTable.getInstance().createItem("Loot", id, 1, player, this); - final int x = getX() + Rnd.get(50); - final int y = getY() + Rnd.get(50); - final int z = getZ(); - drop.dropMe(this, x, y, z); - eng.addNewDrop(drop); - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/ExClientPackets.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/ExClientPackets.java index cfc92c5cce..3db8dd61e5 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/ExClientPackets.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/ExClientPackets.java @@ -313,9 +313,9 @@ public enum ExClientPackets REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME), REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME), REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, null, ConnectionState.IN_GAME), END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME), - REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME), + REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, null, ConnectionState.IN_GAME), REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME), REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME), REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java deleted file mode 100644 index edf4a96572..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameChangeTeam.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chdd d: Arena d: Team - * @author mrTJO - */ -public class RequestExCubeGameChangeTeam implements ClientPacket -{ - private int _arena; - private int _team; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - _team = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - // do not remove players after start - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(_arena)) - { - return; - } - final Player player = client.getPlayer(); - - switch (_team) - { - case 0: - case 1: - { - // Change Player Team - HandysBlockCheckerManager.getInstance().changePlayerToTeam(player, _arena); - break; - } - case -1: - { - // Remove Player (me) - } - { - final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player); - // client sends two times this packet if click on exit - // client did not send this packet on restart - if (team > -1) - { - HandysBlockCheckerManager.getInstance().removePlayer(player, _arena, team); - } - break; - } - default: - { - PacketLogger.warning("Wrong Cube Game Team ID: " + _team); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java deleted file mode 100644 index 469c512697..0000000000 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/RequestExCubeGameReadyAnswer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.ReadablePacket; -import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.PacketLogger; - -/** - * Format: chddd d: Arena d: Answer - * @author mrTJO - */ -public class RequestExCubeGameReadyAnswer implements ClientPacket -{ - private int _arena; - private int _answer; - - @Override - public void read(ReadablePacket packet) - { - // client sends -1,0,1,2 for arena parameter - _arena = packet.readInt() + 1; - // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel - _answer = packet.readInt(); - } - - @Override - public void run(GameClient client) - { - final Player player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_answer) - { - case 0: - { - // Cancel - Answer No - break; - } - case 1: - { - // OK or Time Over - HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena); - break; - } - default: - { - PacketLogger.warning("Unknown Cube Game Answer ID: " + _answer); - break; - } - } - } -} diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index f418d2dc4c..c9b656fb6b 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -83,7 +83,7 @@ public class ExTimedHuntingZoneEnter implements ClientPacket player.sendMessage("Cannot use time-limited hunting zones while waiting for the Olympiad."); return; } - if (player.isOnEvent() || (player.getBlockCheckerArena() > -1)) + if (player.isOnEvent()) { player.sendMessage("Cannot use time-limited hunting zones while registered on an event."); return;