All pastes #23030 Raw Edit

Someone

public text v1 · immutable
#23030 ·published 2005-09-15 22:12 UTC
rendered paste body
# custom 1006: tattoos
# Custom friendly version by DrLecter
# 2005.09.11

# Settings
NPC         = [7729]
QuestId     = 1006
QuestName   = "tattoos"
QuestDesc   = "custom"
InitialHtml = "1.htm"

# Items [name, itemId, takeItemId, takeItemQty, TattooProperties]
Items       = [
["Tattoo of Power",     485,  1458, 181,["pAtk:+5%"]],
["Tattoo of Fire",      486,  1458, 276,["mAtk:+5%","mAtkSpeed:+5%"]],
["Tattoo of Resolve",   487,  1458, 276,["pAtk:+5%","pAtkSpeed:+5%"]],
["Tattoo of Flame",     488,  1459, 428,["mAtk:+10%","max MP:+1000"]],
["Tattoo of Bravery",   489,  1459, 428,["pAtk:+10%","max HP:+1000"]],
["Tattoo of Blood",     490,  1461, 277,["pAtkSpeed:+15%","mAtkSpeed:+15%","Bleed Resist:+10%"]],
["Tattoo of Absolute",  491,  1461, 422,["max HP:+1250","pAtk:+20%","Reflect Dmg:+25%"]],
["Tattoo of Soul",      492,  1458, 181,["mAtk:+5%"]],
["Tattoo of Avadon",    493,  1460, 208,["pAtk:+10%","pAtkSpeed:+10%"]],
["Tattoo of Doom",      494,  1460, 321,["pAtk:+10%","root Resist:+10%","sleep Resist:+10%","stun Resist:+10%"]],
["Tattoo of Pledge",    495,  1460, 208,["mAtk:+10%","mAtkSpeed:+10%"]],
["Tattoo of Divine",    496,  1460, 321,["mAtk:+10%","root Resist:+10%","sleep Resist:+10%","stun Resist:+10%"]],
["Tattoo of Nightmare", 2410, 1461, 422,["putaque pariumax MP:+1250","mAtk:+20%","Reflect Dmg:+25%"]],
]

# ---------------------------------------------------------------------------
# DO NOT MODIFY BELOW THIS LINE
# ---------------------------------------------------------------------------

print "importing " + QuestDesc + ": " + str(QuestId) + ": " + QuestName + ": " + str(len(Items)) + " item(s)",
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

def do_RequestedEvent(item, st, takenId, takenQty) :
    if st.getQuestItemsCount(takenId) >= takenQty :
        st.takeItems(takenId, takenQty)
        st.giveItems(int(item), 1)
        return "Enjoy your new tattoo" 
    else :
        return "You do not have enough crystals."

def show_RequestedEvent(name,item,takenId,takenQty,props) :
    if   takenId==1458: crystal="D Crystals";color='blue'
    elif takenId==1459: crystal="C Crystals";color='green'
    elif takenId==1460: crystal="B Crystals";color='red'
    elif takenId==1461: crystal="A Crystals";color='silver'
    line1='<html><head><body><font color="LEVEL">Item Information</font><br><left><table border=0 width="230"><tr><td>'
    line2='<tr><td><img src=icon.weapon_voodoo_doll_i00 width=32 height=32 align=left><font color="B09878">'+name+'</font></td></tr><br>'
    for prop in props:
        keyvalue= prop.split(":")
        line2=line2+'<tr><td>'+str(keyvalue[0])+':<font color="B09878">'+str(keyvalue[1])+'</font></td></tr><br>'
    line3='<br><tr><td><font color="LEVEL">Crystals required</font></td></tr><br><table width=270><tr><td width=235><table border=0 width="230"><tr><td>'
    line4='<img src=icon.etc_crystal_'+color+'_i00 width=32 height=32 align=left>'+crystal+'</td></tr><tr><td>X '+str(takenQty)+'</td></tr></table></td></tr></table><br><br>'
    line5='<table width=270><tr><td width=90>&nbsp;</td><td width=90>'
    line6='<button value="OK" action="bypass -h Quest 1006_tattoos '+str(item)+'" width=60 height=15 back="sek.cbui94" fore="sek.cbui92"></td>'
    line7='<td width=90><button value="Cancel" action="bypass -h Quest 1006_tattoos 0" width=60 height=15 back="sek.cbui94" fore="sek.cbui92"></td></tr></table><br></left></body></html>'
    return line1+line2+line3+line4+line5+line6+line7

### main code
class Quest (JQuest) :

 def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

 def onEvent (self,event,st) :
    htmltext = event
    if event == "0":
        return InitialHtml
    for item in Items:
        if event == str(item[1])+".htm":
            htmltext = show_RequestedEvent(item[0],item[1],item[2], item[3], item[4])
        elif event == str(item[1]):
            htmltext = do_RequestedEvent(event, st, item[2], item[3])
    return htmltext

 def onTalk (Self,npcId,st):
   htmltext = "<html><head><body>I have nothing to say with you</body></html>"
   id = st.getState()
   if id == CREATED :
     st.setState(COMPLETED)
     st.exitQuest(1)
   return InitialHtml

### Quest class and state definition
QUEST       = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
CREATED     = State('Start',     QUEST)
STARTED     = State('Started',   QUEST)
COMPLETED   = State('Completed', QUEST)

### Quest initialization
QUEST.setInitialState(CREATED)

for item in NPC:
### Quest NPC starter initialization
   QUEST.addStartNpc(item)
### Quest NPC initialization
   STARTED.addTalkId(item)

print "...done"