# Special Deleveling (primarily for spoiler) by Fulminus
print "Start: 9997: DelevelMe"
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
LEVEL_XP = [0,1,69,364,1169,2885,
6039,11288,19424,31379,
48230,71203,101678,141194,
191455,254331,331868,426289,
540001,675597,835863,1023785,
1242547,1495544,1786380,2118877,
2497078,2925251,3407898,3949755,
4555797,5231247,5981577,6812514,
7730045,8740423,9850167,11066073,
12395216,13844952,15422930,17137088,
18995666,21007204,23180551,25524869,
28049636,30764655,33680053,36806290,
40154163,45525134,51262491,57383989,
63907912,70853090,80700832,91162655,
102265882,114038596,126509653,146308200,
167244337,189364894,212717908,237352644,
271975263,308443198,346827154,387199547,
429634523,474207979,532694979,606322775,
696381369,804225364,1999999999]
NPC = [7006,7059,7080,7134,7146,7162,7177,7233,7237,7256,7320]
HTMLEXPLAIN1 = "<html><head><body>I don't know why anybody would really want this, but I am capable of erasing people's experiences with no way to regain them except by training all over again. When this is done, they lose all other physical and mental abilities that come with experience, though they can still remember the skills they have learned.<br>Do you wish to forget your recent experience?<br>(this will delevel you from "
HTMLTO = " to "
HTMLEXPLAIN3 = ")<br><a action=\"bypass -h Quest 9997_DelevelMe 0\">Delevel me please!</a></body></html>"
HTMLCONFIRM1 = "<html><head><body>Are you sure you wish to be deleveled from "
HTMLCONFIRM2 = "<br><a action=\"bypass -h Quest 9997_DelevelMe 1\">Yes, please delevel me!</a><br><a action=\"bypass -h Quest 9997_DelevelMe 2\">No, thank you. I changed my mind.</a></body></html>"
HTMLCANNOT = "<html><head><body>You must have some experience to lose it. I cannot delevel someone who is level 0!</body></html>"
HTMLABORTED = "<html><head><body>You must value your experience...If you wish to be strong, I guess you have no need to forget them.</body></html>"
HTMLGOAGAIN = "<html><head><body>Do you wish to forget more? This will make you level "
HTMLGOAGAIN2 = "<br><a action=\"bypass -h Quest 9997_DelevelMe 0\">Yes, please delevel me!</a><br><a action=\"bypass -h Quest 9997_DelevelMe 2\">No, thank you. I changed my mind.</a></body></html>"
def onEvent (self,event,st) :
currentLevel = st.getPlayer().getLevel()
if event=="0" :
htmltext = HTMLCONFIRM1+str(currentLevel)+HTMLTO+str(currentLevel-1)+HTMLCONFIRM2
elif event=="1" :
if currentLevel > 0 :
currentLevel = currentLevel - 1
st.getPlayer().setXP(LEVEL_XP[currentLevel])
htmltext = HTMLGOAGAIN+str(currentLevel-1)+HTMLGOAGAIN2
else :
htmltext = HTMLCANNOT
st.exitQuest(1)
elif event=="2" :
htmltext = HTMLABORTED
st.exitQuest(1)
return htmltext
def onTalk (self,npc,st):
npcId = npc.getNpcId()
if npcId in NPC :
st.set("cond","0")
st.set("onlyone","0")
st.set("id","0")
currentLevel = st.getPlayer().getLevel()
htmltext = HTMLEXPLAIN1+str(currentLevel)+HTMLTO+str(currentLevel-1)+HTMLEXPLAIN3
return htmltext
return
QUEST = Quest(9997,"9997_DelevelMe","Delevel Me")
CREATED = State('Start', QUEST)
QUEST.setInitialState(CREATED)
print "mid"
for npcId in NPC:
QUEST.addStartNpc(npcId)
CREATED.addTalkId(npcId)
print "importing quests: 9997: DelevelMe"