### Settings
NPC = [NPCID]
QuestId = 9999
QuestName = "weapon"
QuestDesc = "medal_shop"
InitialHtml = "1.htm"
Items = [
["ItemName", ItemID, HowMuchItems, MedalID, HowMuchMedalsneed],
["ItemName", ItemID, HowMuchItems, MedalID, HowMuchMedalsneed]
]
### ---------------------------------------------------------------------------
### 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
### doRequestedEvent
def do_RequestedEvent(event, st, giveItemId, giveItemQty, takeItem1Id, takeItem1Qty) :
if st.getQuestItemsCount(takeItem1Id) >= takeItem1Qty :
st.takeItems(takeItem1Id, takeItem1Qty)
st.giveItems(giveItemId, giveItemQty)
st.exitQuest(1)
return event + ".htm"
else :
return "You do not have enough Medals."
### 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]):
htmltext = do_RequestedEvent(event, st, item[1], item[2], item[3], item[4], item[5], item[6])
if htmltext != event:
st.setState(COMPLETED)
st.exitQuest(1)
return htmltext
def onTalk (Self,npcId,st):
htmltext = "<html><head><body>I have nothing to say with you</body></html>"
st.setState(STARTED)
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"
<html><body>
<table border=0 width=300>
<tr>
<td align=left><font color="LEVEL">Weapon for Medals:</font></td>
<td align=right> </td>
<td width=5>
</td>
</tr>
</table>
<table border=0 width=300>
<tr>
<td width=35 height=45><img src=icon.weapon_youweaponname_i00 width=32 height=32 align=left></td>
<td width=365 valign=top>
<table border=0 width=100%>
<tr><td><a action="bypass -h Quest 9999_weapon 72.htm"><font color="FFFFFF">YouItemName</font> (Grade #)</a></td></tr>
<tr><td><a action="bypass -h Quest 9999_weapon 72.htm"><font color="B09878">Sword (or Other) / # Handed</font></a></td></tr>
</table>
</td>
</tr>
</body></html>
<html><body>
<table border=0 width=300>
<tr>
<td align=left><font color="LEVEL">Item Information</font></td>
<td align=right><button value=Back action="bypass -h Quest 9999_weapon 0" width=40 height=15 back=sek.cbui94 fore=sek.cbui92></td>
<td width=5>
</td>
</tr>
</table>
<table border=0 bgcolor="000000" width=500 height=160>
<tr>
<td valign=top>
<table border=0>
<tr>
<td valign=top width=35><img src=icon.weapon_youweaponname_i00 width=32 height=32 align=left></td>
<td valign=top width=400>
<table border=0 width=100%>
<tr><td><font color="FFFFFF">ItemName</font> (Grade #)</td></tr>
<tr><td><font color="B09878">Sword (or Other) / # Handed</font></td></tr>
</table>
</td>
</tr>
</table>
<table border=0 width=400>
<tr><td valign=top><font color="CCCCCC">P. Atk. :</font> <font color="B09878">WeaponPAtk</font></td></tr>
<tr><td valign=top><font color="CCCCCC">M. Atk. :</font> <font color="B09878">WeaponMAtk</font></td></tr>
<tr><td valign=top><font color="CCCCCC">Atk. Spd. :</font> <font color="B09878">WeaponAtk.Spd.</font></td></tr>
<tr><td valign=top><font color="CCCCCC">Consumed Soulshot :</font> <font color="B09878">X #</font></td></tr>
<tr><td valign=top><font color="CCCCCC">Spirtshot Consumption :</font> <font color="B09878">X #</font></td></tr>
<tr><td valign=top><font color="CCCCCC">Weight :</font> <font color="B09878">WeaponWeight</font></td></tr>
</table>
</td>
</tr>
</table>
<font color="LEVEL">Item Required</font>
<table border=0 bgcolor="000000" width=500 height=120>
<tr>
<td valign=top>
<table border=0>
<tr>
<td valign=top width=35><img src=icon.etc_medal_i00 width=32 height=32 align=left></td>
<td valign=top width=400>
<table border=0 width=100%>
<tr><td><font color="FFFFFF">Medals</font></td></tr>
<tr><td><font color="B09878">X ###</font></td></tr>
</table>
</td>
</tr>
<table border=0 width=300>
<tr><td align=center><button value=Buy action="bypass -h Quest 9999_weapon ItemID" width=60 height=15 back=sek.cbui94 fore=sek.cbui92></td></tr>
</table>
</body></html>
Заменяеш Слова ItemName. Weapon***. # на точ то тебе нужно и все должно работать!
ах да чуть незабыл Текст НПС (прикрепляеш к любому из папки merchants и на него прилепляеш данный выше скрипт):
<html>
<body>
Medal Shop Traderi:
####################YOUTEXT#####################################
I'm sorry but we don't accept adena anymore, only <font color="LEVEL">medals.</font> I hope that's not too inconvenient.
If you're looking for armor, just ask my wife next to me.
<a action="bypass -h npc_%objectId%_Quest 9999_weapon"><font color="LEVEL">Buy Weapons</font></a>
<a action="bypass -h npc_%objectId%_TerritoryStatus">See the Lord and Tax Rate Information</a>
<a action="bypass -h npc_%objectId%_Quest"><font color="LEVEL">Quest</font></a>
</body>
</html>