From 61536f49eeb2ca442fe8efe3f7479431014d132b Mon Sep 17 00:00:00 2001 From: Zoey76 <zoey_76@msn.com> Date: Sun, 4 May 2014 18:16:07 +0000 Subject: [PATCH] BETA: TvT Manager implementation. Reviewed by: Nos, UnAfraid, St3eT --- .../mods/TvTEvent/CursedWeaponEquipped.htm | 1 - .../data/html/mods/TvTEvent/IPRestriction.htm | 1 - .../game/data/html/mods/TvTEvent/Karma.htm | 1 - .../game/data/html/mods/TvTEvent/Level.htm | 1 - .../game/data/html/mods/TvTEvent/Olympiad.htm | 1 - .../data/html/mods/TvTEvent/Participation.htm | 7 - .../html/mods/TvTEvent/ParticipationFee.htm | 1 - .../data/html/mods/TvTEvent/Registered.htm | 1 - .../mods/TvTEvent/RemoveParticipation.htm | 7 - .../game/data/html/mods/TvTEvent/Reward.htm | 1 - .../game/data/html/mods/TvTEvent/Status.htm | 5 - .../data/html/mods/TvTEvent/TeamsFull.htm | 1 - .../data/html/mods/TvTEvent/Unregistered.htm | 1 - L2J_DataPack_BETA/dist/game/data/scripts.cfg | 1 + .../group_template/WarriorFishingBlock.java | 19 ++- .../TvT/TvTManager/CursedWeaponEquipped.htm | 8 + .../events/TvT/TvTManager/IPRestriction.htm | 8 + .../custom/events/TvT/TvTManager/Karma.htm | 8 + .../custom/events/TvT/TvTManager/Level.htm | 8 + .../custom/events/TvT/TvTManager/Olympiad.htm | 8 + .../events/TvT/TvTManager/Participation.htm | 13 ++ .../TvT/TvTManager/ParticipationFee.htm | 8 + .../events/TvT/TvTManager/Registered.htm | 8 + .../TvT/TvTManager/RemoveParticipation.htm | 13 ++ .../custom/events/TvT/TvTManager/Reward.htm | 9 + .../custom/events/TvT/TvTManager/Status.htm | 12 ++ .../events/TvT/TvTManager/TeamsFull.htm | 8 + .../events/TvT/TvTManager/TvTManager.java | 154 ++++++++++++++++++ .../events/TvT/TvTManager/Unregistered.htm | 8 + .../game/data/stats/npcs/custom/custom.xml | 2 +- 30 files changed, 285 insertions(+), 39 deletions(-) delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/CursedWeaponEquipped.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/IPRestriction.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Karma.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Level.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Olympiad.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Participation.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/ParticipationFee.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Registered.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/RemoveParticipation.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Reward.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Status.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/TeamsFull.htm delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Unregistered.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/CursedWeaponEquipped.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/IPRestriction.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Karma.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Level.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Olympiad.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Participation.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/ParticipationFee.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Registered.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/RemoveParticipation.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Reward.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Status.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TeamsFull.htm create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Unregistered.htm diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/CursedWeaponEquipped.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/CursedWeaponEquipped.htm deleted file mode 100644 index 352833a38c..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/CursedWeaponEquipped.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>Cursed weapon owners are not allowed to participate.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/IPRestriction.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/IPRestriction.htm deleted file mode 100644 index 5f624dc116..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/IPRestriction.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>Maximum %max% participant(s) per IP address is allowed.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Karma.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Karma.htm deleted file mode 100644 index d37e683394..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Karma.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>Chaotic players are not allowed to participate.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Level.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Level.htm deleted file mode 100644 index f6d88055b5..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Level.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>Only players from level %min% to level %max% are allowed tro participate.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Olympiad.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Olympiad.htm deleted file mode 100644 index 9f6e79bdb2..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Olympiad.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>You can not participate when registered for Olympiad.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Participation.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Participation.htm deleted file mode 100644 index 28b9f23ddf..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Participation.htm +++ /dev/null @@ -1,7 +0,0 @@ -<html><title>TvT Event</title><body> -Registration for TvT Event:<br><br><center> -%playercount% players in<br> -Participation Fee: %fee%<br> -<button value="Participate" action="bypass -h npc_%objectId%_tvt_event_participation" width=50 height=15 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"> -<button value="Close" action="bypass -h npc_%objectId%_Close" width=50 height=15 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"> -</center></body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/ParticipationFee.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/ParticipationFee.htm deleted file mode 100644 index e2e41c90ac..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/ParticipationFee.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>You need %fee% for participation.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Registered.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Registered.htm deleted file mode 100644 index d653ae8af1..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Registered.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>You are on the registration list now.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/RemoveParticipation.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/RemoveParticipation.htm deleted file mode 100644 index 575a256e9a..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/RemoveParticipation.htm +++ /dev/null @@ -1,7 +0,0 @@ -<html><title>TvT Event</title><body> -Cancel Registration yourself for TvT Event:<br1> -You are already registered for this event. Do you wish to cancel your participation in this Event?<br><center> -Participation fee is not returned!<br> -<button value="Yes" action="bypass -h npc_%objectId%_tvt_event_remove_participation" width=40 height=15 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"> -<button value="No" action="bypass -h npc_%objectId%_Close" width=40 height=15 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"> -</center></body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Reward.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Reward.htm deleted file mode 100644 index a5e0469053..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Reward.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>Your team won the event. Look in your inventory, there should be your reward.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Status.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Status.htm deleted file mode 100644 index bed879d338..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Status.htm +++ /dev/null @@ -1,5 +0,0 @@ -<html><title>TvT Event</title><body> -Status:<br><br><center> -%team1name% with %team1playercount% players and %team1points% points.<br1> -%team2name% with %team2playercount% players and %team2points% points.<br> -</center></body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/TeamsFull.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/TeamsFull.htm deleted file mode 100644 index 1d4b979cf1..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/TeamsFull.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>The event is full! Only %max% players are allowed per team.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Unregistered.htm b/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Unregistered.htm deleted file mode 100644 index a3bf5288f7..0000000000 --- a/L2J_DataPack_BETA/dist/game/data/html/mods/TvTEvent/Unregistered.htm +++ /dev/null @@ -1 +0,0 @@ -<html><head><title>TvT Event</title></head><body>You are not longer on the registration list.</body></html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts.cfg b/L2J_DataPack_BETA/dist/game/data/scripts.cfg index 3bd9c28c5b..94aaeb7859 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts.cfg +++ b/L2J_DataPack_BETA/dist/game/data/scripts.cfg @@ -327,6 +327,7 @@ custom/Validators/SubClassSkills.java custom/events/Elpies/Elpies.java custom/events/Rabbits/Rabbits.java custom/events/Race/Race.java +custom/events/TvT/TvTManager/TvTManager.java # Vehicles vehicles/BoatTalkingGludin.java diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/WarriorFishingBlock.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/WarriorFishingBlock.java index 6731d7c3ec..e5980ba278 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/WarriorFishingBlock.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/WarriorFishingBlock.java @@ -88,16 +88,17 @@ public final class WarriorFishingBlock extends AbstractNpcAI if ((obj == null) || !obj.isPlayer()) { npc.decayMe(); - return super.onSpawn(npc); } - - final L2PcInstance target = obj.getActingPlayer(); - broadcastNpcSay(npc, Say2.NPC_ALL, NPC_STRINGS_ON_SPAWN[getRandom(NPC_STRINGS_ON_SPAWN.length)], target.getName()); - ((L2Attackable) npc).addDamageHate(target, 0, 2000); - npc.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, target); - npc.addAttackerToAttackByList(target); - - startQuestTimer("DESPAWN", DESPAWN_TIME * 1000, npc, target); + else + { + final L2PcInstance target = obj.getActingPlayer(); + broadcastNpcSay(npc, Say2.NPC_ALL, NPC_STRINGS_ON_SPAWN[getRandom(NPC_STRINGS_ON_SPAWN.length)], target.getName()); + ((L2Attackable) npc).addDamageHate(target, 0, 2000); + npc.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, target); + npc.addAttackerToAttackByList(target); + + startQuestTimer("DESPAWN", DESPAWN_TIME * 1000, npc, target); + } break; } case "DESPAWN": diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/CursedWeaponEquipped.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/CursedWeaponEquipped.htm new file mode 100644 index 0000000000..77e95f28cb --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/CursedWeaponEquipped.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + Cursed weapon holders are not allowed to participate. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/IPRestriction.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/IPRestriction.htm new file mode 100644 index 0000000000..74d580f126 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/IPRestriction.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + Maximum of %max% participant(s) per IP address is allowed. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Karma.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Karma.htm new file mode 100644 index 0000000000..4ad6698e5b --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Karma.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + Chaotic players are not allowed to participate. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Level.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Level.htm new file mode 100644 index 0000000000..5d1e0d71a5 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Level.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + Only players from level %min% to level %max% are allowed to participate. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Olympiad.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Olympiad.htm new file mode 100644 index 0000000000..b4829288c9 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Olympiad.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + You can not participate while registered for Olympiad. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Participation.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Participation.htm new file mode 100644 index 0000000000..65db8d24bc --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Participation.htm @@ -0,0 +1,13 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + Registration for TvT Event:<br> + <center> + %playercount% players in.<br> + Participation Fee: %fee%<br> + <button action="bypass -h Quest TvTManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"> + </center> + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/ParticipationFee.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/ParticipationFee.htm new file mode 100644 index 0000000000..9aea7de607 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/ParticipationFee.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + You need %fee% for participation. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Registered.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Registered.htm new file mode 100644 index 0000000000..f6eb819966 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Registered.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + You are registered for a TvT Event. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/RemoveParticipation.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/RemoveParticipation.htm new file mode 100644 index 0000000000..110efb0f54 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/RemoveParticipation.htm @@ -0,0 +1,13 @@ +<html> + <head> + </head><title>TvT Event</title> + </head> + <body> + Cancel registration for TvT Event:<br> + You are already registered for this event. Do you wish to cancel your participation in this Event?<br> + <center> + Participation fee is not returned!<br> + <button action="bypass -h Quest TvTManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back"> + </center> + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Reward.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Reward.htm new file mode 100644 index 0000000000..be404a4c22 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Reward.htm @@ -0,0 +1,9 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + <font color="LEVEL">Your team won the event!</font><br> + Look in your inventory, there should be your reward. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Status.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Status.htm new file mode 100644 index 0000000000..9da25b6062 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Status.htm @@ -0,0 +1,12 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + Status:<br> + <center> + %team1name% with %team1playercount% players and %team1points% points.<br> + %team2name% with %team2playercount% players and %team2points% points. + </center> + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TeamsFull.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TeamsFull.htm new file mode 100644 index 0000000000..311707217f --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TeamsFull.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + The event is full! Only %max% players are allowed per team. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java new file mode 100644 index 0000000000..dca6c28e2e --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2004-2014 L2J DataPack + * + * This file is part of L2J DataPack. + * + * L2J DataPack is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * L2J DataPack is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package custom.events.TvT.TvTManager; + +import ai.npc.AbstractNpcAI; + +import com.l2jserver.Config; +import com.l2jserver.gameserver.instancemanager.AntiFeedManager; +import com.l2jserver.gameserver.model.actor.L2Npc; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.entity.TvTEvent; +import com.l2jserver.gameserver.model.olympiad.OlympiadManager; + +/** + * TvT Manager AI. + * @author Zoey76 + */ +public final class TvTManager extends AbstractNpcAI +{ + private static final int MANAGER_ID = 70010; + + public TvTManager() + { + super(TvTManager.class.getSimpleName(), "custom/events/TvT"); + addFirstTalkId(MANAGER_ID); + addTalkId(MANAGER_ID); + addStartNpc(MANAGER_ID); + } + + @Override + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + if ((player == null) || !TvTEvent.isParticipating()) + { + return super.onAdvEvent(event, npc, player); + } + + String htmltext = null; + switch (event) + { + case "join": + { + int playerLevel = player.getLevel(); + final int team1Count = TvTEvent.getTeamsPlayerCounts()[0]; + final int team2Count = TvTEvent.getTeamsPlayerCounts()[1]; + if (player.isCursedWeaponEquipped()) + { + htmltext = "CursedWeaponEquipped.htm"; + } + else if (OlympiadManager.getInstance().isRegistered(player)) + { + htmltext = "Olympiad.htm"; + } + else if (player.getKarma() > 0) + { + htmltext = "Karma.htm"; + } + else if ((playerLevel < Config.TVT_EVENT_MIN_LVL) || (playerLevel > Config.TVT_EVENT_MAX_LVL)) + { + htmltext = getHtm(player.getHtmlPrefix(), "Level.htm"); + htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.TVT_EVENT_MIN_LVL)); + htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.TVT_EVENT_MAX_LVL)); + } + else if ((team1Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS) && (team2Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS)) + { + htmltext = getHtm(player.getHtmlPrefix(), "TeamsFull.htm"); + htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS)); + } + else if ((Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.TVT_ID, player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP)) + { + htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.htm"); + htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP))); + } + else if (TvTEvent.needParticipationFee() && !TvTEvent.hasParticipationFee(player)) + { + htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.htm"); + htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee()); + } + else if (TvTEvent.addParticipant(player)) + { + htmltext = "Registered.htm"; + } + break; + } + case "remove": + { + TvTEvent.removeParticipant(player.getObjectId()); + if (Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0) + { + AntiFeedManager.getInstance().removePlayer(AntiFeedManager.TVT_ID, player); + } + htmltext = "Unregistered.htm"; + } + } + return htmltext; + } + + @Override + public String onFirstTalk(L2Npc npc, L2PcInstance player) + { + String htmltext = null; + if (TvTEvent.isParticipating()) + { + final boolean isParticipant = TvTEvent.isPlayerParticipant(player.getObjectId()); + int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts(); + htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.htm" : "RemoveParticipation.htm")); + htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); + htmltext = htmltext.replaceAll("%team1name%", Config.TVT_EVENT_TEAM_1_NAME); + htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); + htmltext = htmltext.replaceAll("%team2name%", Config.TVT_EVENT_TEAM_2_NAME); + htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); + htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); + + if (!isParticipant) + { + htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee()); + } + } + else if (TvTEvent.isStarting() || TvTEvent.isStarted()) + { + int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts(); + int[] teamsPointsCounts = TvTEvent.getTeamsPoints(); + htmltext = getHtm(player.getHtmlPrefix(), "Status.htm"); + htmltext = htmltext.replaceAll("%team1name%", Config.TVT_EVENT_TEAM_1_NAME); + htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); + htmltext = htmltext.replaceAll("%team1points%", String.valueOf(teamsPointsCounts[0])); + htmltext = htmltext.replaceAll("%team2name%", Config.TVT_EVENT_TEAM_2_NAME); + htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); + htmltext = htmltext.replaceAll("%team2points%", String.valueOf(teamsPointsCounts[1])); + } + return htmltext; + } + + public static void main(String[] args) + { + new TvTManager(); + } +} diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Unregistered.htm b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Unregistered.htm new file mode 100644 index 0000000000..0223caff93 --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/Unregistered.htm @@ -0,0 +1,8 @@ +<html> + <head> + <title>TvT Event</title> + </head> + <body> + You have been unregistered from the TvT Event. + </body> +</html> \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/stats/npcs/custom/custom.xml b/L2J_DataPack_BETA/dist/game/data/stats/npcs/custom/custom.xml index f079d6a1c4..a13baf3b44 100644 --- a/L2J_DataPack_BETA/dist/game/data/stats/npcs/custom/custom.xml +++ b/L2J_DataPack_BETA/dist/game/data/stats/npcs/custom/custom.xml @@ -6,7 +6,7 @@ <height normal="23" /> </collision> </npc> - <npc id="70010" displayId="31606" name="Catrina" usingServerSideName="true" title="L2J TvT Event Manager" usingServerSideTitle="true" type="L2TvTEventNpc"> + <npc id="70010" displayId="31606" name="Catrina" usingServerSideName="true" title="TvT Event Manager" usingServerSideTitle="true" type="L2Npc"> <collision> <radius normal="8" /> <height normal="15" /> -- GitLab