From b6bdcefdfa1623b4c63c1eaf5ad99292723148b0 Mon Sep 17 00:00:00 2001 From: mobius <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 2 Jan 2015 11:32:08 +0000 Subject: [PATCH] Fishing Championship Tournament. --- trunk/dist/game/config/General.properties | 18 + trunk/dist/game/data/html/fisherman/31562.htm | 2 +- trunk/dist/game/data/html/fisherman/31563.htm | 2 +- trunk/dist/game/data/html/fisherman/31564.htm | 2 +- trunk/dist/game/data/html/fisherman/31565.htm | 2 +- trunk/dist/game/data/html/fisherman/31566.htm | 2 +- trunk/dist/game/data/html/fisherman/31567.htm | 2 +- trunk/dist/game/data/html/fisherman/31568.htm | 2 +- trunk/dist/game/data/html/fisherman/31569.htm | 2 +- trunk/dist/game/data/html/fisherman/31570.htm | 2 +- trunk/dist/game/data/html/fisherman/31571.htm | 2 +- trunk/dist/game/data/html/fisherman/31572.htm | 2 +- trunk/dist/game/data/html/fisherman/31573.htm | 2 +- trunk/dist/game/data/html/fisherman/31574.htm | 2 +- trunk/dist/game/data/html/fisherman/31575.htm | 2 +- trunk/dist/game/data/html/fisherman/31576.htm | 2 +- trunk/dist/game/data/html/fisherman/31577.htm | 2 +- trunk/dist/game/data/html/fisherman/31578.htm | 2 +- trunk/dist/game/data/html/fisherman/31579.htm | 2 +- trunk/dist/game/data/html/fisherman/31696.htm | 2 +- trunk/dist/game/data/html/fisherman/31697.htm | 2 +- trunk/dist/game/data/html/fisherman/31989.htm | 2 +- .../dist/game/data/html/fisherman/32007-2.htm | 2 +- .../dist/game/data/html/fisherman/32007-3.htm | 2 +- .../dist/game/data/html/fisherman/32007-5.htm | 2 +- trunk/dist/game/data/html/fisherman/32007.htm | 2 +- trunk/dist/game/data/html/fisherman/32348.htm | 2 +- .../fisherman/championship/fish_event001.htm | 44 ++ .../fisherman/championship/fish_event002.htm | 43 ++ .../fisherman/championship/fish_event003.htm | 4 + .../championship/fish_event_reward001.htm | 5 + .../championship/no_fish_event001.htm | 4 + .../championship/no_fish_event_reward001.htm | 5 + .../html/fisherman/fishing_championship.htm | 40 -- trunk/dist/sql/game/fishing_championship.sql | 6 + trunk/java/com/l2jserver/Config.java | 14 + .../com/l2jserver/gameserver/GameServer.java | 6 + .../com/l2jserver/gameserver/Shutdown.java | 8 + .../FishingChampionshipManager.java | 549 ++++++++++++++++++ .../actor/instance/L2FishermanInstance.java | 40 ++ .../model/actor/instance/L2PcInstance.java | 2 +- .../gameserver/model/fishing/L2Fishing.java | 6 +- .../clientpackets/RequestExFishRanking.java | 17 +- 43 files changed, 793 insertions(+), 70 deletions(-) create mode 100644 trunk/dist/game/data/html/fisherman/championship/fish_event001.htm create mode 100644 trunk/dist/game/data/html/fisherman/championship/fish_event002.htm create mode 100644 trunk/dist/game/data/html/fisherman/championship/fish_event003.htm create mode 100644 trunk/dist/game/data/html/fisherman/championship/fish_event_reward001.htm create mode 100644 trunk/dist/game/data/html/fisherman/championship/no_fish_event001.htm create mode 100644 trunk/dist/game/data/html/fisherman/championship/no_fish_event_reward001.htm delete mode 100644 trunk/dist/game/data/html/fisherman/fishing_championship.htm create mode 100644 trunk/dist/sql/game/fishing_championship.sql create mode 100644 trunk/java/com/l2jserver/gameserver/instancemanager/FishingChampionshipManager.java diff --git a/trunk/dist/game/config/General.properties b/trunk/dist/game/config/General.properties index 3410cf936a..d7cf2051bb 100644 --- a/trunk/dist/game/config/General.properties +++ b/trunk/dist/game/config/General.properties @@ -686,6 +686,24 @@ AltLottery3NumberRate = 0.2 AltLottery2and1NumberPrize = 200 +# --------------------------------------------------------------------------- +# Fishing Tournament +# --------------------------------------------------------------------------- + +# Enable or disable the Fishing Tournament system +AltFishChampionshipEnabled = True + +# Item Id used as reward +AltFishChampionshipRewardItemId = 57 + +# Item count used as reward (for the 5 first winners) +AltFishChampionshipReward1 = 800000 +AltFishChampionshipReward2 = 500000 +AltFishChampionshipReward3 = 300000 +AltFishChampionshipReward4 = 200000 +AltFishChampionshipReward5 = 100000 + + # --------------------------------------------------------------------------- # Item Auction # --------------------------------------------------------------------------- diff --git a/trunk/dist/game/data/html/fisherman/31562.htm b/trunk/dist/game/data/html/fisherman/31562.htm index aa3ef138df..a5dfc03ada 100644 --- a/trunk/dist/game/data/html/fisherman/31562.htm +++ b/trunk/dist/game/data/html/fisherman/31562.htm @@ -2,7 +2,7 @@ Nice to meet you! Interested in learning about fishing?
There's no better way to enjoy a warm summer day, I can promise you that!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31563.htm b/trunk/dist/game/data/html/fisherman/31563.htm index 0f0786f271..9d7dea740e 100644 --- a/trunk/dist/game/data/html/fisherman/31563.htm +++ b/trunk/dist/game/data/html/fisherman/31563.htm @@ -1,7 +1,7 @@ Fishing Guild Member Perelin:
If you're a nature lover, fishing is the thing for you. Fresh air, warm sun, cool water -- it's perfect!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31564.htm b/trunk/dist/game/data/html/fisherman/31564.htm index 01f1e76532..4bab407148 100644 --- a/trunk/dist/game/data/html/fisherman/31564.htm +++ b/trunk/dist/game/data/html/fisherman/31564.htm @@ -1,7 +1,7 @@ Fishing Guild Member Mishini:
Welcome! Care to take a reel and try your luck? This is the best season for fishing in these parts!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31565.htm b/trunk/dist/game/data/html/fisherman/31565.htm index a4c9962a68..ef306b86bf 100644 --- a/trunk/dist/game/data/html/fisherman/31565.htm +++ b/trunk/dist/game/data/html/fisherman/31565.htm @@ -1,7 +1,7 @@ Fishing Guild Member Ogord:
Welcome! Interested in learning how to fish? I warn you, it's an addictive hobby!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31566.htm b/trunk/dist/game/data/html/fisherman/31566.htm index 3852633307..a6e8276d27 100644 --- a/trunk/dist/game/data/html/fisherman/31566.htm +++ b/trunk/dist/game/data/html/fisherman/31566.htm @@ -2,7 +2,7 @@ Have you ever caught a fish? No? Want to learn? There's no more enjoyable hobby, I promise you.
It can also be profitable -- I'll buy anything you don't want to keep!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31567.htm b/trunk/dist/game/data/html/fisherman/31567.htm index f01f2ac1d0..6c514f48f1 100644 --- a/trunk/dist/game/data/html/fisherman/31567.htm +++ b/trunk/dist/game/data/html/fisherman/31567.htm @@ -2,7 +2,7 @@ Nice to meet you! I am a Fishing Guild Member Bleaker.
In addition to selling fishing equipment, I also teach various fishing techniques. Ah, and I can take your fish, too. Whatever your fishing needs, you've come to the right place!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31568.htm b/trunk/dist/game/data/html/fisherman/31568.htm index 601df7e19c..afebbce737 100644 --- a/trunk/dist/game/data/html/fisherman/31568.htm +++ b/trunk/dist/game/data/html/fisherman/31568.htm @@ -1,7 +1,7 @@ Fishing Guild Member Pamfus:
Do you like fishing? You know I do! Nothing else calms your mind and spirit like spending a quiet afternoon with a fine rod and reel.
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31569.htm b/trunk/dist/game/data/html/fisherman/31569.htm index c36a081dd4..e196002fcd 100644 --- a/trunk/dist/game/data/html/fisherman/31569.htm +++ b/trunk/dist/game/data/html/fisherman/31569.htm @@ -2,7 +2,7 @@ Gludin Harbor is one of the best places for beginners to learn how to fish. Head on down to the beach and try your luck!
I sell bait, and if you catch any fish I'll be happy to buy them from you.
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31570.htm b/trunk/dist/game/data/html/fisherman/31570.htm index 85c283f6cc..9ffadaeb77 100644 --- a/trunk/dist/game/data/html/fisherman/31570.htm +++ b/trunk/dist/game/data/html/fisherman/31570.htm @@ -3,7 +3,7 @@ So did you hook a big one?
Fishing isn't as easy as it looks. If you want to be successful, you need to use the right bait at the right spot at the right time.
Come see me when you need the right equipment and I'll set you up.
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31571.htm b/trunk/dist/game/data/html/fisherman/31571.htm index 769cdf4f9d..cc4094d793 100644 --- a/trunk/dist/game/data/html/fisherman/31571.htm +++ b/trunk/dist/game/data/html/fisherman/31571.htm @@ -2,7 +2,7 @@ Welcome! Want to learn how to fish?
There's no better way to spend a leisurely afternoon, matching wits and muscles with some elusive quarry...
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31572.htm b/trunk/dist/game/data/html/fisherman/31572.htm index b88da3a7ff..748a3d6700 100644 --- a/trunk/dist/game/data/html/fisherman/31572.htm +++ b/trunk/dist/game/data/html/fisherman/31572.htm @@ -2,7 +2,7 @@ Everything is plentiful here in Giran, which is why so many people spend their leisure time fishing. Care to try it?
Ah, pardon me -- I forgot to introduce myself! I am Ofulle, the only officially licensed fishing professional in this territory! Come see me whenever you need bait, fishing gear or want to sell the fish you've caught. I'll by anything...except mermaids, that is! Ha ha ha!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31573.htm b/trunk/dist/game/data/html/fisherman/31573.htm index 954b4110a6..7d758e4f9f 100644 --- a/trunk/dist/game/data/html/fisherman/31573.htm +++ b/trunk/dist/game/data/html/fisherman/31573.htm @@ -2,7 +2,7 @@ Nice to meet you! I am Monakan.
Besides teaching you how to fish, I also sell the fishing gear you'll need. Oh, and I'll buy any fish you catch. In other words, this is your one-stop fishing shop!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31574.htm b/trunk/dist/game/data/html/fisherman/31574.htm index 54c04eec25..cc0be0d9ff 100644 --- a/trunk/dist/game/data/html/fisherman/31574.htm +++ b/trunk/dist/game/data/html/fisherman/31574.htm @@ -1,7 +1,7 @@ Fishing Guild Member Willeri:
Fishing has become all the rage in these parts! Of course, there are the serious fishermen, and then there are those who just want an excuse to daydream drowsily in the sun. Which one are you, I wonder?
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31575.htm b/trunk/dist/game/data/html/fisherman/31575.htm index 29901e8e21..59f48507c4 100644 --- a/trunk/dist/game/data/html/fisherman/31575.htm +++ b/trunk/dist/game/data/html/fisherman/31575.htm @@ -2,7 +2,7 @@ There's no better place for fishing than Innadril. Wet and warm all year round, beautiful scenery, exotic locales. Best place in the whole world!
I mean, how can you go wrong in a place that boasts a "city of water"!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31576.htm b/trunk/dist/game/data/html/fisherman/31576.htm index 5e808d8514..c73d2809e0 100644 --- a/trunk/dist/game/data/html/fisherman/31576.htm +++ b/trunk/dist/game/data/html/fisherman/31576.htm @@ -2,7 +2,7 @@ It's a mistake to think that there are only hunters here, just because the name of this place is "Hunter's Village." Many great fisherman have also come from here! Including me! Ha ha ha!
Well, care to go fishing? Let's not waste a minute of this beautiful weather!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31577.htm b/trunk/dist/game/data/html/fisherman/31577.htm index 1c23ce3ac4..505899398e 100644 --- a/trunk/dist/game/data/html/fisherman/31577.htm +++ b/trunk/dist/game/data/html/fisherman/31577.htm @@ -2,7 +2,7 @@ You know, the king is an avid fisherman himself -- and quite a good one, in fact.
Aden is filled with prime fishing spots. How about spending this beautiful day on the shores of one of them?
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31578.htm b/trunk/dist/game/data/html/fisherman/31578.htm index 740052b8b3..990e70eb8f 100644 --- a/trunk/dist/game/data/html/fisherman/31578.htm +++ b/trunk/dist/game/data/html/fisherman/31578.htm @@ -2,7 +2,7 @@ Welcome, my young friend! Nice to meet you! It's a great day to go fishing!
My family have been members of the fishing guild since my great-grandfather joined. In fact, that's why I was sent here to Rune. Not only is the fishing particularly challenging here, but it's become something of a hobby among the elite.
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31579.htm b/trunk/dist/game/data/html/fisherman/31579.htm index 3ae7100759..f9031aec1a 100644 --- a/trunk/dist/game/data/html/fisherman/31579.htm +++ b/trunk/dist/game/data/html/fisherman/31579.htm @@ -1,7 +1,7 @@ Fishing Guild Member Klaw:
Thanks to its many mountain streams and lakes, Goddard is a prime fishing spot. People come from all over to test their skill and try their luck here. You interested?
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31696.htm b/trunk/dist/game/data/html/fisherman/31696.htm index 5f27139211..8a6ab3a1f8 100644 --- a/trunk/dist/game/data/html/fisherman/31696.htm +++ b/trunk/dist/game/data/html/fisherman/31696.htm @@ -2,7 +2,7 @@ The fishing spots near here are the only ones in Elmore from which you can catch actual sea fish. Back during the Elmoreden Empire, they were famous throughout the kingdom. Now the lack of ships has revitalized them.
Care to give it a try? If you catch something good, be sure to show it to me!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31697.htm b/trunk/dist/game/data/html/fisherman/31697.htm index 32cc87f8c2..96e84a398f 100644 --- a/trunk/dist/game/data/html/fisherman/31697.htm +++ b/trunk/dist/game/data/html/fisherman/31697.htm @@ -2,7 +2,7 @@ Do you know about these hot springs? The effects of the nearby Forge of Gods has created a whole network of them around here. Even more surprising, there are special species of fish living in these hot springs. How can any fisherman worth the name ignore an opportunity like that!
Enjoy the fishing here and let me know if you need anything!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/31989.htm b/trunk/dist/game/data/html/fisherman/31989.htm index 7f197fcbd5..a22212fac4 100644 --- a/trunk/dist/game/data/html/fisherman/31989.htm +++ b/trunk/dist/game/data/html/fisherman/31989.htm @@ -2,7 +2,7 @@ Hey, good to see you! You came here to fish, right?
Well, it's a better way to spend an afternoon than breaking your back in some dark and dank mine!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/32007-2.htm b/trunk/dist/game/data/html/fisherman/32007-2.htm index 8ffaa1723b..a79bbdf473 100644 --- a/trunk/dist/game/data/html/fisherman/32007-2.htm +++ b/trunk/dist/game/data/html/fisherman/32007-2.htm @@ -1,7 +1,7 @@ Fishing Guild Member Galba:
Excellent! If you have anything else this good, bring it to me right away!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish. diff --git a/trunk/dist/game/data/html/fisherman/32007-3.htm b/trunk/dist/game/data/html/fisherman/32007-3.htm index ea851c11cd..c58e59fde6 100644 --- a/trunk/dist/game/data/html/fisherman/32007-3.htm +++ b/trunk/dist/game/data/html/fisherman/32007-3.htm @@ -1,7 +1,7 @@ Fishing Guild Member Galba:
If you want to catch the biggest, use the best -- that's my motto. When you want to upgrade your gear, come find me.
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish. diff --git a/trunk/dist/game/data/html/fisherman/32007-5.htm b/trunk/dist/game/data/html/fisherman/32007-5.htm index d2c6ebcae9..37fb79055e 100644 --- a/trunk/dist/game/data/html/fisherman/32007-5.htm +++ b/trunk/dist/game/data/html/fisherman/32007-5.htm @@ -1,7 +1,7 @@ Fishing Guild Member Galba:
Pal, you seem to have made a mistake. There's nothing here to buy!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish. diff --git a/trunk/dist/game/data/html/fisherman/32007.htm b/trunk/dist/game/data/html/fisherman/32007.htm index 3af3fd91b2..4a65bb0e6a 100644 --- a/trunk/dist/game/data/html/fisherman/32007.htm +++ b/trunk/dist/game/data/html/fisherman/32007.htm @@ -2,7 +2,7 @@ Rainbow Springs is a fishing heaven! There's no place like it.
Not only are the fish large and fat, but several fisherman have even fished up a Clan Hall War Decree. Before you start fishing, let me know if you need any gear or have anything to sell.
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/32348.htm b/trunk/dist/game/data/html/fisherman/32348.htm index c9931157ca..66f895481b 100644 --- a/trunk/dist/game/data/html/fisherman/32348.htm +++ b/trunk/dist/game/data/html/fisherman/32348.htm @@ -2,7 +2,7 @@ Some call me the "doctor of fishing," some think I'm just all wet. Ha ha!
Of course, I sell fishing gear and teach a variety of fishing techniques. I'll also buy any fish you've caught!
Ask how to fish.
-Fishing Contest
+Fishing Contest.
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
diff --git a/trunk/dist/game/data/html/fisherman/championship/fish_event001.htm b/trunk/dist/game/data/html/fisherman/championship/fish_event001.htm new file mode 100644 index 0000000000..cb80002219 --- /dev/null +++ b/trunk/dist/game/data/html/fisherman/championship/fish_event001.htm @@ -0,0 +1,44 @@ +The Fishing King Championship Tournament +Fishing Guild Member:
+The Fishing King Championship Tournament is currently underway! In case you haven't heard, the tournament is an event funded by members of the Fishing Guild to promote the sport of fishing. Anyone who catches a big fish during the competition will be awarded prizes.
+After the event is over, those of you who appear on the winners list can claim your prize money from a Fishing Guild member. Remember, you must claim your prize no later than one week after the event ends!
+This list will be updated in %refresh% minute(s)!
+
Claim Prize
+Fishing King Rankings
+ + + + + + + %TABLE% +
RankingFishermanLength

+
List of Prize Items
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
RankingReward ItemQuantity
1st%prizeItem%%prizeFirst%
2nd%prizeItem%%prizeTwo%
3rd%prizeItem%%prizeThree%
4th%prizeItem%%prizeFour%
5th%prizeItem%%prizeFive%
+ \ No newline at end of file diff --git a/trunk/dist/game/data/html/fisherman/championship/fish_event002.htm b/trunk/dist/game/data/html/fisherman/championship/fish_event002.htm new file mode 100644 index 0000000000..7438091d6c --- /dev/null +++ b/trunk/dist/game/data/html/fisherman/championship/fish_event002.htm @@ -0,0 +1,43 @@ +The Fishing King Championship Tournament +Ahoy! Here are the results of last week's Fishing King Championship Tournament!
+Do you see your name on the list? If you do, claim your prize money!
+Remember, you have only one week to claim your prize.
+Don't fret if your name isn't listed this time. Next week, there will be a new group of winners!
+Fishing King Rankings + + + + + + + %TABLE% +
RankingFishermanLength

+
List of Prize Items
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
RankingReward ItemQuantity
1st%prizeItem%%prizeFirst%
2nd%prizeItem%%prizeTwo%
3rd%prizeItem%%prizeThree%
4th%prizeItem%%prizeFour%
5th%prizeItem%%prizeFive%
+ \ No newline at end of file diff --git a/trunk/dist/game/data/html/fisherman/championship/fish_event003.htm b/trunk/dist/game/data/html/fisherman/championship/fish_event003.htm new file mode 100644 index 0000000000..aabe953263 --- /dev/null +++ b/trunk/dist/game/data/html/fisherman/championship/fish_event003.htm @@ -0,0 +1,4 @@ +The Fishing King Championship Tournament +The winners of the Fishing King Championship Tournament are currently being determined.
+Results will be posted shortly. + \ No newline at end of file diff --git a/trunk/dist/game/data/html/fisherman/championship/fish_event_reward001.htm b/trunk/dist/game/data/html/fisherman/championship/fish_event_reward001.htm new file mode 100644 index 0000000000..7b6ec7cc24 --- /dev/null +++ b/trunk/dist/game/data/html/fisherman/championship/fish_event_reward001.htm @@ -0,0 +1,5 @@ +The Fishing King Championship Tournament +Congratulations!
+Here's your prize! You're a true fisherman!
+Good luck next week! + \ No newline at end of file diff --git a/trunk/dist/game/data/html/fisherman/championship/no_fish_event001.htm b/trunk/dist/game/data/html/fisherman/championship/no_fish_event001.htm new file mode 100644 index 0000000000..b8684e84f1 --- /dev/null +++ b/trunk/dist/game/data/html/fisherman/championship/no_fish_event001.htm @@ -0,0 +1,4 @@ +The Fishing King Championship Tournament +There are currently no recorded results available.
+Please try again at a later date. + \ No newline at end of file diff --git a/trunk/dist/game/data/html/fisherman/championship/no_fish_event_reward001.htm b/trunk/dist/game/data/html/fisherman/championship/no_fish_event_reward001.htm new file mode 100644 index 0000000000..feaaae7b3b --- /dev/null +++ b/trunk/dist/game/data/html/fisherman/championship/no_fish_event_reward001.htm @@ -0,0 +1,5 @@ +The Fishing King Championship Tournament +Sorry, but I can't find your name on the winners' list.
+Unfortunately, I can't offer you a prize at this time.
+I wish you a better luck in the next Fishing King Championship Tournament! + \ No newline at end of file diff --git a/trunk/dist/game/data/html/fisherman/fishing_championship.htm b/trunk/dist/game/data/html/fisherman/fishing_championship.htm deleted file mode 100644 index 292e2e51bf..0000000000 --- a/trunk/dist/game/data/html/fisherman/fishing_championship.htm +++ /dev/null @@ -1,40 +0,0 @@ - -Fishing King Championship Tournament - -Fishing Guild Member:

-Ahoy! Here are the results of last week's Fishing King Championship Tournament!
-Do you see your name on the list? If you do, claim your prize money!
-Remember, you have only one week to claim your prize.
-Don't fret if your name isn't listed this time. Next week, there will be a new group of winners!
-This list will be updated in 0 minute(s)!

-
-Claim Prize
-
-
- - - -
Ranking Fisherman Length
- - - - - - - -
1st Not Working00.00
2nd Not Working00.00
3rd Not Working00.00
4th Not Working00.00
5th Not Working00.00

-List of Prize Items -
- - -
Ranking Reward Item Quantity
- - - - - - - -
1st Adena 800000
2nd Adena 500000
3rd Adena 300000
4th Adena 200000
5th Adena 100000
-
- \ No newline at end of file diff --git a/trunk/dist/sql/game/fishing_championship.sql b/trunk/dist/sql/game/fishing_championship.sql new file mode 100644 index 0000000000..c57d1aaaf5 --- /dev/null +++ b/trunk/dist/sql/game/fishing_championship.sql @@ -0,0 +1,6 @@ +DROP TABLE IF EXISTS `fishing_championship`; +CREATE TABLE IF NOT EXISTS `fishing_championship` ( + `player_name` VARCHAR(35) NOT NULL, + `fish_length` DOUBLE(10,3) NOT NULL, + `rewarded` INT(1) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/trunk/java/com/l2jserver/Config.java b/trunk/java/com/l2jserver/Config.java index 3f195b47b6..17ba1c604f 100644 --- a/trunk/java/com/l2jserver/Config.java +++ b/trunk/java/com/l2jserver/Config.java @@ -610,6 +610,13 @@ public final class Config public static float ALT_LOTTERY_4_NUMBER_RATE; public static float ALT_LOTTERY_3_NUMBER_RATE; public static long ALT_LOTTERY_2_AND_1_NUMBER_PRIZE; + public static boolean ALT_FISH_CHAMPIONSHIP_ENABLED; + public static int ALT_FISH_CHAMPIONSHIP_REWARD_ITEM; + public static int ALT_FISH_CHAMPIONSHIP_REWARD_1; + public static int ALT_FISH_CHAMPIONSHIP_REWARD_2; + public static int ALT_FISH_CHAMPIONSHIP_REWARD_3; + public static int ALT_FISH_CHAMPIONSHIP_REWARD_4; + public static int ALT_FISH_CHAMPIONSHIP_REWARD_5; public static boolean ALT_ITEM_AUCTION_ENABLED; public static int ALT_ITEM_AUCTION_EXPIRED_AFTER; public static long ALT_ITEM_AUCTION_TIME_EXTENDS_ON_BID; @@ -1930,6 +1937,13 @@ public final class Config ALT_LOTTERY_4_NUMBER_RATE = General.getFloat("AltLottery4NumberRate", 0.2f); ALT_LOTTERY_3_NUMBER_RATE = General.getFloat("AltLottery3NumberRate", 0.2f); ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = General.getLong("AltLottery2and1NumberPrize", 200); + ALT_FISH_CHAMPIONSHIP_ENABLED = General.getBoolean("AltFishChampionshipEnabled", true); + ALT_FISH_CHAMPIONSHIP_REWARD_ITEM = General.getInt("AltFishChampionshipRewardItemId", 57); + ALT_FISH_CHAMPIONSHIP_REWARD_1 = General.getInt("AltFishChampionshipReward1", 800000); + ALT_FISH_CHAMPIONSHIP_REWARD_2 = General.getInt("AltFishChampionshipReward2", 500000); + ALT_FISH_CHAMPIONSHIP_REWARD_3 = General.getInt("AltFishChampionshipReward3", 300000); + ALT_FISH_CHAMPIONSHIP_REWARD_4 = General.getInt("AltFishChampionshipReward4", 200000); + ALT_FISH_CHAMPIONSHIP_REWARD_5 = General.getInt("AltFishChampionshipReward5", 100000); ALT_ITEM_AUCTION_ENABLED = General.getBoolean("AltItemAuctionEnabled", true); ALT_ITEM_AUCTION_EXPIRED_AFTER = General.getInt("AltItemAuctionExpiredAfter", 14); ALT_ITEM_AUCTION_TIME_EXTENDS_ON_BID = General.getInt("AltItemAuctionTimeExtendsOnBid", 0) * 1000; diff --git a/trunk/java/com/l2jserver/gameserver/GameServer.java b/trunk/java/com/l2jserver/gameserver/GameServer.java index e80e3215ea..e275cc53bd 100644 --- a/trunk/java/com/l2jserver/gameserver/GameServer.java +++ b/trunk/java/com/l2jserver/gameserver/GameServer.java @@ -108,6 +108,7 @@ import com.l2jserver.gameserver.instancemanager.ClanHallManager; import com.l2jserver.gameserver.instancemanager.CoupleManager; import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager; import com.l2jserver.gameserver.instancemanager.DayNightSpawnManager; +import com.l2jserver.gameserver.instancemanager.FishingChampionshipManager; import com.l2jserver.gameserver.instancemanager.FortManager; import com.l2jserver.gameserver.instancemanager.FortSiegeManager; import com.l2jserver.gameserver.instancemanager.FourSepulchersManager; @@ -362,6 +363,11 @@ public class GameServer CoupleManager.getInstance(); } + if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED) + { + FishingChampionshipManager.getInstance(); + } + TaskManager.getInstance(); AntiFeedManager.getInstance().registerEvent(AntiFeedManager.GAME_ID); diff --git a/trunk/java/com/l2jserver/gameserver/Shutdown.java b/trunk/java/com/l2jserver/gameserver/Shutdown.java index 15997964ee..b7325dd3f9 100644 --- a/trunk/java/com/l2jserver/gameserver/Shutdown.java +++ b/trunk/java/com/l2jserver/gameserver/Shutdown.java @@ -30,6 +30,7 @@ import com.l2jserver.gameserver.datatables.OfflineTradersTable; import com.l2jserver.gameserver.instancemanager.CHSiegeManager; import com.l2jserver.gameserver.instancemanager.CastleManorManager; import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager; +import com.l2jserver.gameserver.instancemanager.FishingChampionshipManager; import com.l2jserver.gameserver.instancemanager.GlobalVariablesManager; import com.l2jserver.gameserver.instancemanager.GrandBossManager; import com.l2jserver.gameserver.instancemanager.ItemAuctionManager; @@ -541,6 +542,13 @@ public class Shutdown extends Thread GlobalVariablesManager.getInstance().storeMe(); _log.info("Global Variables Manager: Variables saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); + // Save Fishing tournament data + if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED) + { + FishingChampionshipManager.getInstance().shutdown(); + _log.info("Fishing Championship data has been saved."); + } + // Save items on ground before closing if (Config.SAVE_DROPPED_ITEM) { diff --git a/trunk/java/com/l2jserver/gameserver/instancemanager/FishingChampionshipManager.java b/trunk/java/com/l2jserver/gameserver/instancemanager/FishingChampionshipManager.java new file mode 100644 index 0000000000..f058e06c9a --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/instancemanager/FishingChampionshipManager.java @@ -0,0 +1,549 @@ +/* + * Copyright (C) 2004-2014 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * L2J Server is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.l2jserver.gameserver.instancemanager; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.l2jserver.Config; +import com.l2jserver.L2DatabaseFactory; +import com.l2jserver.gameserver.ThreadPoolManager; +import com.l2jserver.gameserver.datatables.ItemTable; +import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.network.SystemMessageId; +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; +import com.l2jserver.gameserver.network.serverpackets.SystemMessage; +import com.l2jserver.util.Rnd; + +/** + * @author n0nam3 + * @date 08/08/2010 15:11 + */ +public class FishingChampionshipManager +{ + protected static final Logger _log = Logger.getLogger(FishingChampionshipManager.class.getName()); + + private static final String INSERT = "INSERT INTO fishing_championship(player_name,fish_length,rewarded) VALUES (?,?,?)"; + private static final String DELETE = "DELETE FROM fishing_championship"; + private static final String SELECT = "SELECT `player_name`, `fish_length`, `rewarded` FROM fishing_championship"; + + private static final FishingChampionshipManager _instance = new FishingChampionshipManager(); + + public static FishingChampionshipManager getInstance() + { + return _instance; + } + + protected long _enddate = 0; + protected final List _playersName = new ArrayList<>(); + protected final List _fishLength = new ArrayList<>(); + protected final List _winPlayersName = new ArrayList<>(); + protected final List _winFishLength = new ArrayList<>(); + protected final List _tmpPlayers = new ArrayList<>(); + protected final List _winPlayers = new ArrayList<>(); + protected double _minFishLength = 0; + protected boolean _needRefresh = true; + + private FishingChampionshipManager() + { + restoreData(); + refreshWinResult(); + recalculateMinLength(); + + if (_enddate <= System.currentTimeMillis()) + { + _enddate = System.currentTimeMillis(); + new finishChamp().run(); + } + else + { + ThreadPoolManager.getInstance().scheduleGeneral(new finishChamp(), _enddate - System.currentTimeMillis()); + } + } + + protected void setEndOfChamp() + { + Calendar finishtime = Calendar.getInstance(); + finishtime.setTimeInMillis(_enddate); + finishtime.set(Calendar.MINUTE, 0); + finishtime.set(Calendar.SECOND, 0); + finishtime.add(Calendar.DAY_OF_MONTH, 6); + finishtime.set(Calendar.DAY_OF_WEEK, 3); + finishtime.set(Calendar.HOUR_OF_DAY, 19); + _enddate = finishtime.getTimeInMillis(); + } + + private void restoreData() + { + _enddate = GlobalVariablesManager.getInstance().getLong("fishChampionshipEnd", 0); + + try (Connection con = L2DatabaseFactory.getInstance().getConnection()) + { + PreparedStatement statement = con.prepareStatement(SELECT); + ResultSet rs = statement.executeQuery(); + while (rs.next()) + { + int rewarded = rs.getInt("rewarded"); + if (rewarded == 0) + { + _tmpPlayers.add(new Fisher(rs.getString("player_name"), rs.getDouble("fish_length"), 0)); + } + else if (rewarded > 0) + { + _winPlayers.add(new Fisher(rs.getString("player_name"), rs.getDouble("fish_length"), rewarded)); + } + } + rs.close(); + statement.close(); + } + catch (SQLException e) + { + _log.log(Level.WARNING, "FishingChampionshipManager: can't restore fishing championship info: " + e.getMessage(), e); + } + } + + public synchronized void newFish(L2PcInstance pl, int lureId) + { + if (!Config.ALT_FISH_CHAMPIONSHIP_ENABLED) + { + return; + } + + double len = Rnd.get(60, 89) + (Rnd.get(0, 1000) / 1000.); + if ((lureId >= 8484) && (lureId <= 8486)) + { + len += Rnd.get(0, 3000) / 1000.; + } + + pl.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CAUGHT_A_FISH_S1_IN_LENGTH).addString(String.valueOf(len))); + + if (_tmpPlayers.size() < 5) + { + for (Fisher fisher : _tmpPlayers) + { + if (fisher.getName().equalsIgnoreCase(pl.getName())) + { + if (fisher.getLength() < len) + { + fisher.setLength(len); + pl.sendPacket(SystemMessageId.BECAUSE_OF_THE_SIZE_OF_FISH_CAUGHT_YOU_WILL_BE_REGISTERED_IN_THE_RANKING); + recalculateMinLength(); + } + return; + } + } + _tmpPlayers.add(new Fisher(pl.getName(), len, 0)); + pl.sendPacket(SystemMessageId.BECAUSE_OF_THE_SIZE_OF_FISH_CAUGHT_YOU_WILL_BE_REGISTERED_IN_THE_RANKING); + recalculateMinLength(); + } + else if (_minFishLength < len) + { + for (Fisher fisher : _tmpPlayers) + { + if (fisher.getName().equalsIgnoreCase(pl.getName())) + { + if (fisher.getLength() < len) + { + fisher.setLength(len); + pl.sendPacket(SystemMessageId.BECAUSE_OF_THE_SIZE_OF_FISH_CAUGHT_YOU_WILL_BE_REGISTERED_IN_THE_RANKING); + recalculateMinLength(); + } + return; + } + } + + Fisher minFisher = null; + double minLen = 99999.; + for (Fisher fisher : _tmpPlayers) + { + if (fisher.getLength() < minLen) + { + minFisher = fisher; + minLen = minFisher.getLength(); + } + } + _tmpPlayers.remove(minFisher); + _tmpPlayers.add(new Fisher(pl.getName(), len, 0)); + pl.sendPacket(SystemMessageId.BECAUSE_OF_THE_SIZE_OF_FISH_CAUGHT_YOU_WILL_BE_REGISTERED_IN_THE_RANKING); + recalculateMinLength(); + } + } + + private void recalculateMinLength() + { + double minLen = 99999.; + for (Fisher fisher : _tmpPlayers) + { + if (fisher.getLength() < minLen) + { + minLen = fisher.getLength(); + } + } + _minFishLength = minLen; + } + + public long getTimeRemaining() + { + return (_enddate - System.currentTimeMillis()) / 60000; + } + + public String getWinnerName(int par) + { + if (_winPlayersName.size() >= par) + { + return _winPlayersName.get(par - 1); + } + + return "None"; + } + + public String getCurrentName(int par) + { + if (_playersName.size() >= par) + { + return _playersName.get(par - 1); + } + + return "None"; + } + + public String getFishLength(int par) + { + if (_winFishLength.size() >= par) + { + return _winFishLength.get(par - 1); + } + + return "0"; + } + + public String getCurrentFishLength(int par) + { + if (_fishLength.size() >= par) + { + return _fishLength.get(par - 1); + } + + return "0"; + } + + public boolean isWinner(String playerName) + { + for (String name : _winPlayersName) + { + if (name.equals(playerName)) + { + return true; + } + } + return false; + } + + public void getReward(L2PcInstance pl) + { + for (Fisher fisher : _winPlayers) + { + if (fisher.getName().equalsIgnoreCase(pl.getName())) + { + if (fisher.getRewardType() != 2) + { + int rewardCnt = 0; + for (int x = 0; x < _winPlayersName.size(); x++) + { + if (_winPlayersName.get(x).equalsIgnoreCase(pl.getName())) + { + switch (x) + { + case 0: + rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_1; + break; + + case 1: + rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_2; + break; + + case 2: + rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_3; + break; + + case 3: + rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_4; + break; + + case 4: + rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_5; + break; + } + } + } + fisher.setRewardType(2); + if (rewardCnt > 0) + { + pl.addItem("fishing_reward", Config.ALT_FISH_CHAMPIONSHIP_REWARD_ITEM, rewardCnt, null, true); + + final NpcHtmlMessage html = new NpcHtmlMessage(); + html.setFile(pl.getHtmlPrefix(), "data/html/fisherman/championship/fish_event_reward001.htm"); + pl.sendPacket(html); + } + } + } + } + } + + public void showMidResult(L2PcInstance pl) + { + final NpcHtmlMessage html = new NpcHtmlMessage(); + + if (_needRefresh) + { + html.setFile(pl.getHtmlPrefix(), "data/html/fisherman/championship/fish_event003.htm"); + pl.sendPacket(html); + + refreshResult(); + ThreadPoolManager.getInstance().scheduleGeneral(new needRefresh(), 60000); + return; + } + + html.setFile(pl.getHtmlPrefix(), "data/html/fisherman/championship/fish_event002.htm"); + + String str = null; + for (int x = 1; x <= 5; x++) + { + str += "" + x + ""; + str += "" + getCurrentName(x) + ""; + str += "" + getCurrentFishLength(x) + ""; + } + html.replace("%TABLE%", str); + html.replace("%prizeItem%", ItemTable.getInstance().getTemplate(Config.ALT_FISH_CHAMPIONSHIP_REWARD_ITEM).getName()); + html.replace("%prizeFirst%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_1)); + html.replace("%prizeTwo%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_2)); + html.replace("%prizeThree%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_3)); + html.replace("%prizeFour%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_4)); + html.replace("%prizeFive%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_5)); + pl.sendPacket(html); + } + + public void showChampScreen(L2PcInstance pl, L2NpcInstance npc) + { + final NpcHtmlMessage html = new NpcHtmlMessage(); + html.setFile(pl.getHtmlPrefix(), "data/html/fisherman/championship/fish_event001.htm"); + + String str = null; + for (int x = 1; x <= 5; x++) + { + str += "" + x + ""; + str += "" + getWinnerName(x) + ""; + str += "" + getFishLength(x) + ""; + } + html.replace("%TABLE%", str); + html.replace("%prizeItem%", ItemTable.getInstance().getTemplate(Config.ALT_FISH_CHAMPIONSHIP_REWARD_ITEM).getName()); + html.replace("%prizeFirst%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_1)); + html.replace("%prizeTwo%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_2)); + html.replace("%prizeThree%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_3)); + html.replace("%prizeFour%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_4)); + html.replace("%prizeFive%", String.valueOf(Config.ALT_FISH_CHAMPIONSHIP_REWARD_5)); + html.replace("%refresh%", String.valueOf(getTimeRemaining())); + html.replace("%objectId%", String.valueOf(npc.getObjectId())); + pl.sendPacket(html); + } + + public void shutdown() + { + GlobalVariablesManager.getInstance().set("fishChampionshipEnd", _enddate); + + try (Connection con = L2DatabaseFactory.getInstance().getConnection()) + { + PreparedStatement statement = con.prepareStatement(DELETE); + statement.execute(); + statement.close(); + + for (Fisher fisher : _winPlayers) + { + statement = con.prepareStatement(INSERT); + statement.setString(1, fisher.getName()); + statement.setDouble(2, fisher.getLength()); + statement.setInt(3, fisher.getRewardType()); + statement.execute(); + statement.close(); + } + + for (Fisher fisher : _tmpPlayers) + { + statement = con.prepareStatement(INSERT); + statement.setString(1, fisher.getName()); + statement.setDouble(2, fisher.getLength()); + statement.setInt(3, 0); + statement.execute(); + statement.close(); + } + } + catch (SQLException e) + { + _log.log(Level.WARNING, "FishingChampionshipManager: can't update infos: " + e.getMessage(), e); + } + } + + private synchronized void refreshResult() + { + _needRefresh = false; + + _playersName.clear(); + _fishLength.clear(); + + Fisher fisher1; + Fisher fisher2; + + for (int x = 0; x <= (_tmpPlayers.size() - 1); x++) + { + for (int y = 0; y <= (_tmpPlayers.size() - 2); y++) + { + fisher1 = _tmpPlayers.get(y); + fisher2 = _tmpPlayers.get(y + 1); + if (fisher1.getLength() < fisher2.getLength()) + { + _tmpPlayers.set(y, fisher2); + _tmpPlayers.set(y + 1, fisher1); + } + } + } + + for (int x = 0; x <= (_tmpPlayers.size() - 1); x++) + { + _playersName.add(_tmpPlayers.get(x).getName()); + _fishLength.add(String.valueOf(_tmpPlayers.get(x).getLength())); + } + } + + protected void refreshWinResult() + { + _winPlayersName.clear(); + _winFishLength.clear(); + + Fisher fisher1; + Fisher fisher2; + + for (int x = 0; x <= (_winPlayers.size() - 1); x++) + { + for (int y = 0; y <= (_winPlayers.size() - 2); y++) + { + fisher1 = _winPlayers.get(y); + fisher2 = _winPlayers.get(y + 1); + if (fisher1.getLength() < fisher2.getLength()) + { + _winPlayers.set(y, fisher2); + _winPlayers.set(y + 1, fisher1); + } + } + } + + for (int x = 0; x <= (_winPlayers.size() - 1); x++) + { + _winPlayersName.add(_winPlayers.get(x).getName()); + _winFishLength.add(String.valueOf(_winPlayers.get(x).getLength())); + } + } + + private class finishChamp implements Runnable + { + protected finishChamp() + { + // Do nothing + } + + @Override + public void run() + { + _winPlayers.clear(); + for (Fisher fisher : _tmpPlayers) + { + fisher.setRewardType(1); + _winPlayers.add(fisher); + } + _tmpPlayers.clear(); + + refreshWinResult(); + setEndOfChamp(); + shutdown(); + + _log.info("FishingChampionshipManager : new event period start."); + ThreadPoolManager.getInstance().scheduleGeneral(new finishChamp(), _enddate - System.currentTimeMillis()); + } + } + + private class needRefresh implements Runnable + { + protected needRefresh() + { + // Do nothing + } + + @Override + public void run() + { + _needRefresh = true; + } + } + + private class Fisher + { + private double _length; + private final String _name; + private int _reward; + + public Fisher(String name, double length, int rewardType) + { + _name = name; + _length = length; + _reward = rewardType; + } + + public void setLength(double value) + { + _length = value; + } + + public void setRewardType(int value) + { + _reward = value; + } + + public String getName() + { + return _name; + } + + public int getRewardType() + { + return _reward; + } + + public double getLength() + { + return _length; + } + } +} \ No newline at end of file diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java index 33276f22f0..4389672d35 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java @@ -20,13 +20,17 @@ package com.l2jserver.gameserver.model.actor.instance; import java.util.List; +import com.l2jserver.Config; import com.l2jserver.gameserver.datatables.SkillTreesData; import com.l2jserver.gameserver.enums.InstanceType; +import com.l2jserver.gameserver.instancemanager.FishingChampionshipManager; import com.l2jserver.gameserver.model.L2SkillLearn; +import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jserver.gameserver.model.base.AcquireSkillType; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExAcquirableSkillListByClass; +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; public final class L2FishermanInstance extends L2MerchantInstance @@ -61,6 +65,35 @@ public final class L2FishermanInstance extends L2MerchantInstance { showFishSkillList(player); } + else if (command.startsWith("FishingChampionship")) + { + if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED) + { + FishingChampionshipManager.getInstance().showChampScreen(player, this); + } + else + { + sendHtml(player, this, "no_fish_event001.htm"); + } + } + else if (command.startsWith("FishingReward")) + { + if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED) + { + if (FishingChampionshipManager.getInstance().isWinner(player.getName())) + { + FishingChampionshipManager.getInstance().getReward(player); + } + else + { + sendHtml(player, this, "no_fish_event_reward001.htm"); + } + } + else + { + sendHtml(player, this, "no_fish_event001.htm"); + } + } else { super.onBypassFeedback(player, command); @@ -90,4 +123,11 @@ public final class L2FishermanInstance extends L2MerchantInstance player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.FISHING)); } } + + private static void sendHtml(L2PcInstance player, L2Npc npc, String htmlName) + { + final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); + html.setFile(player.getHtmlPrefix(), "data/html/fisherman/championship/" + htmlName); + player.sendPacket(html); + } } diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java index 48013c070e..473883ff04 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java @@ -11938,7 +11938,7 @@ public final class L2PcInstance extends L2Playable public void startFishCombat(boolean isNoob, boolean isUpperGrade) { - _fishCombat = new L2Fishing(this, _fish, isNoob, isUpperGrade); + _fishCombat = new L2Fishing(this, _fish, isNoob, isUpperGrade, _lure.getId()); } public void endFishing(boolean win) diff --git a/trunk/java/com/l2jserver/gameserver/model/fishing/L2Fishing.java b/trunk/java/com/l2jserver/gameserver/model/fishing/L2Fishing.java index 39a6a5bff3..1ee5a97081 100644 --- a/trunk/java/com/l2jserver/gameserver/model/fishing/L2Fishing.java +++ b/trunk/java/com/l2jserver/gameserver/model/fishing/L2Fishing.java @@ -22,6 +22,7 @@ import java.util.concurrent.Future; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.datatables.FishingMonstersData; +import com.l2jserver.gameserver.instancemanager.FishingChampionshipManager; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.events.AbstractScript; @@ -49,6 +50,7 @@ public class L2Fishing implements Runnable private int _fishCurHp; private final double _regenHp; private final boolean _isUpperGrade; + private final int _lureId; @Override public void run() @@ -76,7 +78,7 @@ public class L2Fishing implements Runnable } } - public L2Fishing(L2PcInstance Fisher, L2Fish fish, boolean isNoob, boolean isUpperGrade) + public L2Fishing(L2PcInstance Fisher, L2Fish fish, boolean isNoob, boolean isUpperGrade, int lureId) { _fisher = Fisher; _fishMaxHp = fish.getFishHp(); @@ -85,6 +87,7 @@ public class L2Fishing implements Runnable _fishId = fish.getItemId(); _time = fish.getCombatDuration(); _isUpperGrade = isUpperGrade; + _lureId = lureId; final int lureType; if (isUpperGrade) { @@ -160,6 +163,7 @@ public class L2Fishing implements Runnable { _fisher.sendPacket(SystemMessageId.YOU_CAUGHT_SOMETHING); _fisher.addItem("Fishing", _fishId, 1, null, true); + FishingChampionshipManager.getInstance().newFish(_fisher, _lureId); } } } diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestExFishRanking.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestExFishRanking.java index 81b553fd2f..dd3356acea 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestExFishRanking.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestExFishRanking.java @@ -18,6 +18,10 @@ */ package com.l2jserver.gameserver.network.clientpackets; +import com.l2jserver.Config; +import com.l2jserver.gameserver.instancemanager.FishingChampionshipManager; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + /** * Format: (ch) just a trigger * @author -Wooden- @@ -35,7 +39,16 @@ public final class RequestExFishRanking extends L2GameClientPacket @Override protected void runImpl() { - _log.info("C5: RequestExFishRanking"); + final L2PcInstance activeChar = getClient().getActiveChar(); + if (activeChar == null) + { + return; + } + + if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED) + { + FishingChampionshipManager.getInstance().showMidResult(activeChar); + } } @Override @@ -43,4 +56,4 @@ public final class RequestExFishRanking extends L2GameClientPacket { return _C__D0_18_REQUESTEXFISHRANKING; } -} \ No newline at end of file +}