diff --git a/L2J_DataPack_BETA/dist/game/data/scripts.cfg b/L2J_DataPack_BETA/dist/game/data/scripts.cfg
index 63294173444c55aa4d2c18e997039914b4b6e50e..45e7de5a8685d9acab4526058ccb724b39bf3b56 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts.cfg
+++ b/L2J_DataPack_BETA/dist/game/data/scripts.cfg
@@ -489,7 +489,7 @@ quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java
 quests/362_BardsMandolin/__init__.py
 quests/363_SorrowfulSoundofFlute/__init__.py
 quests/364_JovialAccordion/__init__.py
-quests/365_DevilsLegacy/__init__.py
+quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java
 quests/366_SilverHairedShaman/__init__.py
 quests/367_ElectrifyingRecharge/__init__.py
 quests/368_TrespassingIntoTheSacredArea/__init__.py
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-0.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-0.htm
deleted file mode 100644
index 1ab761ea39c0e18ac91b072722be76c9de702f72..0000000000000000000000000000000000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-0.htm
+++ /dev/null
@@ -1,6 +0,0 @@
-<html><body>Warehouse Keeper Randolf:<br>
-Have you heard of the notorius pirate Zaken? His dogged pursuit of<font color="LEVEL"> treasure</font> led him to a rockly island now called "Devil's Isle". His increasingly eccentric behavior caused him to lose the confidence of his crew, and they marooned him there.<br>
-In despair, Zaken turned to the forces of darkness, who gave him power to kill and imprison the souls of all of those who betrayed him. Even now, the souls of thise damned warriors roam that barren place.<br>
-I suppose you knew this already. But here is something you probably don't know... It is said that<font color="LEVEL"> Zaken's treasure was stolen by his betrayers</font>, and they still have it! So what do you think? Will you help me find the treasure?<br>
-<a action="bypass -h Quest 365_DevilsLegacy 30095-1.htm">I will help.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-0a.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-0a.htm
deleted file mode 100644
index 7991e5a74dd2749c6e000bf40df8a327024d0c32..0000000000000000000000000000000000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-0a.htm
+++ /dev/null
@@ -1,6 +0,0 @@
-<html><body>Warehouse Keeper Randolf:<br>
-Have you heard of the notorius pirate Zaken? His dogged pursuit of<font color="LEVEL"> treasure</font> led him to a rockly island now called "Devil's Isle". His increasingly eccentric behavior caused him to lose the confidence of his crew, and they marooned him there.<br>
-In despair, Zaken turned to the forces of darkness, who gave him power to kill and imprison the souls of all of those who betrayed him. Even now, the souls of thise damned warriors roam that barren place.<br>
-I suppose you knew this already. But here is something you probably don't know... It is said that<font color="LEVEL"> Zaken's treasure was stolen by his betrayers</font>, and they still have it! So what do you think? Will you help me find the treasure?<br>
-<font color="LEVEL">(Quest for characters level 39 and above)</font>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-1.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-1.htm
deleted file mode 100644
index 2f7037cf70593f15841a7b8b86cd6e7d8203d209..0000000000000000000000000000000000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-1.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warehouse Keeper Randolf:<br>
-Good choice! We will both benefit from our arrangement...<br>
-Go to<font color="LEVEL"> Devil's Isle</font>, slay the<font color="LEVEL"> pirate zombies and their captains</font>, collect their<font color="LEVEL"> Treasure Chests</font> and bring them to me. You shall be well rewarded.
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-2.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-2.htm
deleted file mode 100644
index ce477f72684f4b5d1ddfea8c2e3b18d43c689850..0000000000000000000000000000000000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-2.htm
+++ /dev/null
@@ -1,5 +0,0 @@
-<html><body>Warehouse Keeper Randolf:<br>
-Go to<font color="LEVEL"> Devil's Isle</font>, slay the<font color="LEVEL"> pirate zombies and their captains</font>, collect their<font color="LEVEL"> Treasure Chests</font> and bring them to me. You will be well rewarded.<br>
-<a action="bypass -h Quest 365_DevilsLegacy 30095-6.htm">I quit.</a><br>
-<a action="bypass -h Quest 365_DevilsLegacy 30095-3.htm">I will do it.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-4.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-4.htm
deleted file mode 100644
index 936d92be177004ca3685065eb0007da196a3df97..0000000000000000000000000000000000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-4.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warehouse Keeper Randolf:<br>
-Do you have some Treasure Chests for me?<br>
-<a action="bypass -h Quest 365_DevilsLegacy 30095-5.htm">Here they are.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/__init__.py b/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/__init__.py
deleted file mode 100644
index 52b150170e1b99a49c64b6b54b91032be8eea0ac..0000000000000000000000000000000000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/__init__.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# Made by disKret
-import sys
-from com.l2jserver.gameserver.model.quest import State
-from com.l2jserver.gameserver.model.quest import QuestState
-from com.l2jserver.gameserver.model.quest import Quest as JQuest
-
-qn = "365_DevilsLegacy"
-
-#NPC
-RANDOLF = 30095
-#MOBS
-MOBS=[20836,29027,20845,21629,21630,29026]
-#CHANCE OF DROP
-CHANCE_OF_DROP = 20
-#ITEMS
-TREASURE_CHEST = 5873
-
-class Quest (JQuest) :
-
- def __init__(self,id,name,descr):
-     JQuest.__init__(self,id,name,descr)
-     self.questItemIds = [TREASURE_CHEST]
-
- def onEvent (self,event,st) :
-   htmltext = event
-   if event == "30095-1.htm" :
-     st.set("cond","1")
-     st.setState(State.STARTED)
-     st.playSound("ItemSound.quest_accept")
-   elif event == "30095-5.htm" :
-     count = st.getQuestItemsCount(TREASURE_CHEST)
-     if count :
-        reward = (count*1600)
-        st.takeItems(TREASURE_CHEST,-1)
-        st.giveItems(57,reward)
-     else:
-        htmltext="You don't have required items"
-   elif event == "30095-6.htm" :
-     st.playSound("ItemSound.quest_finish")
-     st.exitQuest(1)
-   return htmltext
-
- def onTalk (self,npc,player):
-   htmltext = Quest.getNoQuestMsg(player)
-   st = player.getQuestState(qn)
-   if not st : return htmltext
-
-   npcId = npc.getId()
-   id = st.getState()
-   cond=st.getInt("cond")
-   if cond == 0 :
-     if player.getLevel() >= 39 :
-       htmltext = "30095-0.htm"
-     else :
-       htmltext = "30095-0a.htm"
-       st.exitQuest(1)
-   elif cond == 1 :
-     if not st.getQuestItemsCount(TREASURE_CHEST) :
-        htmltext = "30095-2.htm"
-     else :
-        htmltext = "30095-4.htm"
-   return htmltext
-
- def onKill(self,npc,player,isPet):
-   partyMember = self.getRandomPartyMemberState(player,State.STARTED)
-   if not partyMember : return
-   st = partyMember.getQuestState(qn)
-   
-   chance = self.getRandom(100)
-   if chance < CHANCE_OF_DROP :
-     st.giveItems(TREASURE_CHEST,1)
-     st.playSound("ItemSound.quest_itemget")
-   return
-
-QUEST       = Quest(365,qn,"Devil's Legacy")
-
-QUEST.addStartNpc(RANDOLF)
-QUEST.addTalkId(RANDOLF)
-for mob in MOBS:
-    QUEST.addKillId(mob)
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-01.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-01.html
new file mode 100644
index 0000000000000000000000000000000000000000..8ffb9955e6b5ef1c4afb9738a136935639e518d1
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-01.html
@@ -0,0 +1,5 @@
+<html><body>Warehouse Keeper Collob:<br>
+Are you collecting <font color="LEVEL">Pirate's Treasure Chests</font>? Bring me one and I'll open it for you. All I ask is that you pay for making the key. <font color="LEVEL">It costs 600 adena.</font><br>
+However, you should know that this chest carries a curse. <font color="LEVEL">You must be willing to risk receiving the curse. </font><br>
+<a action="bypass -h Quest Q00365_DevilsLegacy REWARD">"Open the chest."</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-02.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-02.html
new file mode 100644
index 0000000000000000000000000000000000000000..166bd258d636e5ef217e3804cc380ca9e42bbf74
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-02.html
@@ -0,0 +1,3 @@
+<html><body>Warehouse Keeper Collob:<br>
+Hmm, you no longer have a chest. Please, go get one and come back.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-03.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-03.html
new file mode 100644
index 0000000000000000000000000000000000000000..e5de027a070d4d2b820ec35a11c14f4a63759bcb
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-03.html
@@ -0,0 +1,4 @@
+<html><body>Warehouse Keeper Collob:<br>
+You don't have the adena needed to pay for the key.<br>
+The key that will open the chest costs 600 adena.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-04.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-04.html
new file mode 100644
index 0000000000000000000000000000000000000000..12881175b39f479a60d3c9c4ba45ae24d090086b
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-04.html
@@ -0,0 +1,4 @@
+<html><body>Warehouse Keeper Collob:<br>
+I'm afraid the curse is having an effect on me. Perhaps if I rest I'll feel better. I'm going to bed. Please come back later.<br>
+Why don't you go to Devil's Isle and collect a few more Treasure Chests?
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-05.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-05.html
new file mode 100644
index 0000000000000000000000000000000000000000..a1407eb7926c9b95f249d97d94405bf752d35de6
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-05.html
@@ -0,0 +1,3 @@
+<html><body>Warehouse Keeper Collob:<br>
+The chest is open. Are you pleased with its contents?
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-06.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-06.html
new file mode 100644
index 0000000000000000000000000000000000000000..3c77786f8b5a501767faae53c68c0db0b2f89ef8
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-06.html
@@ -0,0 +1,4 @@
+<html><body>Warehouse Keeper Collob:<br>
+The chest is open.<br>
+Oh no!! The curse of the pirates! I can't move...!
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-07.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-07.html
new file mode 100644
index 0000000000000000000000000000000000000000..12881175b39f479a60d3c9c4ba45ae24d090086b
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30092-07.html
@@ -0,0 +1,4 @@
+<html><body>Warehouse Keeper Collob:<br>
+I'm afraid the curse is having an effect on me. Perhaps if I rest I'll feel better. I'm going to bed. Please come back later.<br>
+Why don't you go to Devil's Isle and collect a few more Treasure Chests?
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-01.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-01.htm
new file mode 100644
index 0000000000000000000000000000000000000000..8ce9df244d8bbdc3297e9feaf5646d18e327f836
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-01.htm
@@ -0,0 +1,6 @@
+<html><body>Warehouse Keeper Randolf:<br>
+Have you  heard of the notorious Pirate Captain Zaken? His dogged pursuit of <font color="LEVEL">treasure</font> led him to a rocky island now called "Devil's Isle." His increasingly eccentric behavior caused him to lose the confidence of his crew, and they marooned him there.<br>
+In despair, Zaken turned to the forces of darkness, who gave him the power to kill and imprison the souls of all of those who betrayed him. Even now, the souls of those damned warriors roam that barren place.<br>
+I suppose you knew this already. But here is something you probably don't know... It is said that <font color="LEVEL">Zaken's treasure was stolen by his betrayers</font>, and they still have it! So what do you think? Will you help me find the treasure?<br>
+<a action="bypass -h Quest Q00365_DevilsLegacy 30095-02.html">"I will help."</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-02.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-02.html
new file mode 100644
index 0000000000000000000000000000000000000000..523a0dbe067f87a0ba3e3fc5b0b90794e463cd0e
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-02.html
@@ -0,0 +1,4 @@
+<html><body>Warehouse Keeper Randolf:<br>
+Good choice! We will both benefit from our arrangement...<br>
+Go to <font color="LEVEL">Devil's Isle</font>, slay the <font color="LEVEL">pirate zombies and their captains</font>, collect their <font color="LEVEL">Treasure Chests</font> and bring them to me. You shall be well rewarded.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-03.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-03.html
new file mode 100644
index 0000000000000000000000000000000000000000..2b3f84f3bfebf8b255cbf25407dfe8be7227f56c
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-03.html
@@ -0,0 +1,6 @@
+<html><body>Warehouse Keeper Randolf:<br>
+Have you  heard of the notorious Pirate Captain Zaken? His dogged pursuit of <font color="LEVEL">treasure</font> led him to a rocky island now called "Devil's Isle." His increasingly eccentric behavior caused him to lose the confidence of his crew, and they marooned him there.<br>
+In despair, Zaken turned to the forces of darkness, who gave him the power to kill and imprison the souls of all of those who betrayed him. Even now, the souls of those damned warriors roam that barren place.<br>
+There is more you should know, but you are not yet ready.<br>
+(This quest may only be undertaken by a character of level 39 or above.)
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-5.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-04.html
similarity index 73%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-5.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-04.html
index 142f38c6ecc018f384a6334825aae79e65149201..043dd1bb9f403d7b54a95217ad21b33e222c33c4 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-5.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-04.html
@@ -1,7 +1,7 @@
 <html><body>Warehouse Keeper Randolf:<br>
 Good job! You shall have your reward.<br>
 I hope you don't feel that you've been cheated. Not all the chests hold treasure, but the key required to open them is very expensive. Not to mention the magical scroll I must buy to protect against the horrible pirate curse that these chests sometimes impart. Truly, I take a terrible risk each time I open one. This is not a highly profitable business.<br>
-You should be happy to get your reward regardless of whether or not the chests hold treasure. I hope we can continue to do business together. Don't be fooled by<font color="LEVEL"> Collob</font>. He will probably offer to open the chests for you. His lack of experience could lead to terrible consequences...<br>
-<a action="bypass -h Quest 365_DevilsLegacy 30095-6.htm">I quit</a><br>
-<a action="bypass -h Quest 365_DevilsLegacy 30095-3.htm">I will continue to work with you.</a>
+You should be happy to get your reward regardless of whether or not the chests hold treasure. I hope we can continue to do business together. Don't be fooled by <font color="LEVEL">Collob</font>. He will probably offer to open the chests for you. His lack of experience could lead to terrible consequences...<br>
+<a action="bypass -h Quest Q00365_DevilsLegacy 30095-05.html">"I quit."</a><br>
+<a action="bypass -h Quest Q00365_DevilsLegacy 30095-06.html">"I will continue to work with you."</a>
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-6.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-05.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-6.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-05.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-3.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-06.html
similarity index 68%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-3.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-06.html
index e3edebef29ee1a8ebdad36a9ff59b8a129527a90..cbd7958cb9febd32bfb7bd6191a514405933f0ee 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/365_DevilsLegacy/30095-3.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-06.html
@@ -1,3 +1,3 @@
 <html><body>Warehouse Keeper Randolf:<br>
-Go to Devil's Isle, slay the pirate zombies and their captains, collect their Treasure Chests and bring them to me.
+Go to Devil's Isle, slay the pirate zombies and their captains, and bring back their Treasure Chests.
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-07.html b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-07.html
new file mode 100644
index 0000000000000000000000000000000000000000..41df102e63ac89b1276ef810ba28a0dfdc4639eb
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/30095-07.html
@@ -0,0 +1,5 @@
+<html><body>Warehouse Keeper Randolf:<br>
+Go to <font color="LEVEL">Devil's Isle</font>, slay the <font color="LEVEL">pirate zombies and their captains</font>, collect their <font color="LEVEL">Treasure Chests </font> and bring them to me. You will be well rewarded.<br>
+<a action="bypass -h Quest Q00365_DevilsLegacy 30095-05.html">"I quit."</a><br>
+<a action="bypass -h Quest Q00365_DevilsLegacy 30095-06.html">"I will do it."</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java
new file mode 100644
index 0000000000000000000000000000000000000000..f7033579f6eeddad92d4c35092abcc99f396b919
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2004-2013 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 quests.Q00365_DevilsLegacy;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.holders.SkillHolder;
+import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+
+/**
+ * Devil's Legacy (365)
+ * @author Adry_85
+ */
+public final class Q00365_DevilsLegacy extends Quest
+{
+	// NPCs
+	private static final int COLLOB = 30092;
+	private static final int RANDOLF = 30095;
+	// Item
+	private static final int PIRATES_TREASURE_CHEST = 5873;
+	// Rewards
+	private static final int ENCHANT_WEAPON_C = 951;
+	private static final int ENCHANT_ARMOR_C = 952;
+	private static final int ENCHANT_WEAPON_D = 955;
+	private static final int ENCHANT_ARMOR_D = 956;
+	private static final int THREAD = 1868;
+	private static final int ANIMAL_BONE = 1872;
+	private static final int COKES = 1879;
+	private static final int STEEL = 1880;
+	private static final int COARSE_BONE_POWDER = 1881;
+	private static final int LEATHER = 1882;
+	private static final int CORD = 1884;
+	// Misc
+	private static final int MIN_LEVEL = 39;
+	// Skill
+	private static SkillHolder POISON = new SkillHolder(4035, 2);
+	// Mobs
+	private static final Map<Integer, Double> MOBS = new HashMap<>();
+	static
+	{
+		MOBS.put(20836, 0.47); // pirates_zombie
+		MOBS.put(20845, 0.40); // pirates_zombie_captain
+		MOBS.put(21629, 0.40); // pirates_zombie_captain_1
+		MOBS.put(21630, 0.40); // pirates_zombie_captain_2
+	}
+	
+	private Q00365_DevilsLegacy()
+	{
+		super(365, Q00365_DevilsLegacy.class.getSimpleName(), "Devil's Legacy");
+		addStartNpc(RANDOLF);
+		addTalkId(RANDOLF, COLLOB);
+		addKillId(MOBS.keySet());
+		registerQuestItems(PIRATES_TREASURE_CHEST);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		final QuestState st = player.getQuestState(getName());
+		if (st == null)
+		{
+			return null;
+		}
+		
+		String htmltext = null;
+		switch (event)
+		{
+			case "30095-02.html":
+			{
+				st.startQuest();
+				st.setMemoState(1);
+				htmltext = event;
+				break;
+			}
+			case "30095-05.html":
+			{
+				st.exitQuest(true, true);
+				htmltext = event;
+				break;
+			}
+			case "30095-06.html":
+			{
+				htmltext = event;
+				break;
+			}
+			case "REWARD":
+			{
+				if (!st.isMemoState(1))
+				{
+					htmltext = "30092-04.html";
+				}
+				else if (!st.hasQuestItems(PIRATES_TREASURE_CHEST))
+				{
+					htmltext = "30092-02.html";
+				}
+				else if (player.getAdena() < 600)
+				{
+					htmltext = "30092-03.html";
+				}
+				else
+				{
+					final int itemId;
+					final int chance;
+					if (getRandom(100) < 80)
+					{
+						chance = getRandom(100);
+						if (chance < 1)
+						{
+							itemId = ENCHANT_WEAPON_D;
+						}
+						else if (chance < 4)
+						{
+							itemId = ENCHANT_ARMOR_D;
+						}
+						else if (chance < 36)
+						{
+							itemId = THREAD;
+						}
+						else if (chance < 68)
+						{
+							itemId = CORD;
+						}
+						else
+						{
+							itemId = ANIMAL_BONE;
+						}
+						htmltext = "30092-05.html";
+					}
+					else
+					{
+						chance = getRandom(1000);
+						if (chance < 10)
+						{
+							itemId = ENCHANT_WEAPON_C;
+						}
+						else if (chance < 40)
+						{
+							itemId = ENCHANT_ARMOR_C;
+						}
+						else if (chance < 60)
+						{
+							itemId = ENCHANT_WEAPON_D;
+						}
+						else if (chance < 260)
+						{
+							itemId = ENCHANT_ARMOR_D;
+						}
+						else if (chance < 445)
+						{
+							itemId = COKES;
+						}
+						else if (chance < 630)
+						{
+							itemId = STEEL;
+						}
+						else if (chance < 815)
+						{
+							itemId = LEATHER;
+						}
+						else
+						{
+							itemId = COARSE_BONE_POWDER;
+						}
+						npc.setTarget(player);
+						npc.doCast(POISON.getSkill());
+						npc.setCurrentMp(npc.getMaxMp());
+						st.setMemoState(2);
+						htmltext = "30092-06.html";
+					}
+					takeItems(player, PIRATES_TREASURE_CHEST, 1);
+					takeItems(player, PcInventory.ADENA_ID, 600);
+					rewardItems(player, itemId, 1);
+				}
+				break;
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+	{
+		final QuestState st = getRandomPartyMemberState(player, -1, 3, npc);
+		if (st != null)
+		{
+			giveItemRandomly(player, npc, PIRATES_TREASURE_CHEST, 1, 0, MOBS.get(npc.getId()), true);
+		}
+		return super.onKill(npc, player, isSummon);
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		QuestState st = player.getQuestState(getName());
+		String htmltext = getNoQuestMsg(player);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (npc.getId())
+		{
+			case RANDOLF:
+			{
+				if (st.isCreated())
+				{
+					htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30095-01.htm" : "30095-03.html");
+				}
+				else if (st.isStarted())
+				{
+					if (hasQuestItems(player, PIRATES_TREASURE_CHEST))
+					{
+						final long chestCount = getQuestItemsCount(player, PIRATES_TREASURE_CHEST);
+						giveAdena(player, (chestCount * 400) + 19800, true);
+						takeItems(player, PIRATES_TREASURE_CHEST, -1);
+						htmltext = "30095-04.html";
+					}
+					else
+					{
+						htmltext = "30095-07.html";
+					}
+				}
+				break;
+			}
+			case COLLOB:
+			{
+				if (st.isStarted())
+				{
+					htmltext = (st.isMemoState(1) ? "30092-01.html" : "30092-07.html");
+				}
+				break;
+			}
+		}
+		return htmltext;
+	}
+	
+	public static void main(String args[])
+	{
+		new Q00365_DevilsLegacy();
+	}
+}
diff --git a/L2J_DataPack_BETA/dist/sql/game/updates/20131025update.sql b/L2J_DataPack_BETA/dist/sql/game/updates/20131025update.sql
new file mode 100644
index 0000000000000000000000000000000000000000..291327cf2fc200648d6fc984a5fed888cb302376
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/sql/game/updates/20131025update.sql
@@ -0,0 +1 @@
+UPDATE character_quests SET name='Q00365_DevilsLegacy' WHERE name='365_DevilsLegacy';
\ No newline at end of file