Перейти к содержанию
Авторизация  
MrJaconda

L2jimpulse 12.09 + Donateshop For S-project

Рекомендуемые сообщения

Ошибка в Донат шопе (s-project)

.(q8015_Enchex, 917_Clan, 919_Enchanter, q8014_LifeStone).

e72b92589ae5.png

 

Error

- q8015_Enchex

__init__.py.error.log

Error on: C:\System\zacaz\Core\data\scripts\custom\q8015_Enchex\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
 File "__init__.py", line 7, in ?
ImportError: no module named serverpackets

 

917_Clan

__init__.py.error.log

Error on: C:\System\zacaz\Core\data\scripts\custom\917_Clan\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
 File "__init__.py", line 8, in ?
ImportError: no module named serverpackets

 

919_Enchanter

__init__.py.error.log

Error on: C:\System\zacaz\Core\data\scripts\custom\919_Enchanter\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
 File "__init__.py", line 8, in ?
ImportError: no module named serverpackets

 

q8014_LifeStone

__init__.py.error.log

Error on: C:\System\zacaz\Core\data\scripts\custom\q8014_LifeStone\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
 File "__init__.py", line 4, in ?
ImportError: no module named serverpackets

 

 

 

 

Сделайте пожалуйста для L2JImpulse 12.09

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

q8015_Enchex

__init__.py

 

import sys
from java.lang import System
from net.sf.l2j import L2DatabaseFactory
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
from net.sf.l2j.gameserver.network.serverpackets import CharInfo
from net.sf.l2j.gameserver.network.serverpackets import InventoryUpdate
from net.sf.l2j.gameserver.network.serverpackets import ItemList
from net.sf.l2j.gameserver.network.serverpackets import UserInfo
from net.sf.l2j.gameserver.templates import L2Item

qn = "q8015_Enchex"

#id нпц
NPC = 300300

#id итема для заточки
ITEM = 4037
#стоимость заточки за каждый +
COST =50
#название итема
INAME = "Event Coin"
#список запрещенных итемов
FORBIDDEN = [12,132,6611,6612,6620,6617,6619,6618,6621,6614,6616]

print "Loaded: q8015_Enchex - OK"

class Quest (JQuest) :

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

def onAdvEvent (self,event,npc,player):
  st = player.getQuestState(qn)
  if event == "spisok":
 htmltext = "<html><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI.SquareBlank\" width=260 height=2><br1>"	   
 htmltext += u"<table width=260><tr><td align=center><font color=LEVEL>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438</font></td></tr></table>"
 htmltext += u"<button value=\"\u041e\u0440\u0443\u0436\u0438\u0435[S]\" action=\"bypass -h Quest q8015_Enchex step1_0\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
 htmltext += u"<button value=\"\u0428\u043c\u043e\u0442\u043a\u0438[S]\" action=\"bypass -h Quest q8015_Enchex step1_1\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
 htmltext += u"<button value=\"\u0411\u0438\u0436\u0443\u0442\u0435\u0440\u0438\u044f[S]\" action=\"bypass -h Quest q8015_Enchex jewerly\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
 htmltext += "<center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32></center></body></html>"
  elif event.startswith("step1_"):
 itemType = int(event.replace("step1_", ""))
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0442\u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br><br><table width=300>"
 if itemType == 0:
   TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"]
 elif itemType == 1:
   TYPES = ["Light","Heavy","Magic"]
 else:
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430.</body></html>"
   return htmltext
 st.set("type",str(itemType))
 for Item in st.getPlayer().getInventory().getItems():
   itemTemplate = Item.getItem()
   idtest = Item.getItemId()
   itype = str(Item.getItemType())
   grade = itemTemplate.getCrystalType()
   if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itype in TYPES and Item.getEnchantLevel() > 0:
	 con=L2DatabaseFactory.getInstance().getConnection()
	 listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
	 listitems.setInt(1, idtest)
	 rs=listitems.executeQuery()
	 while (rs.next()) :
	   icon=rs.getString("itemIcon")
	   try :
		 grades = {1: "D", 2: "C", 3: "B", 4: "A", 5: "S"}
		 pgrade = grades.get(grade, str(""))
		 if Item.getEnchantLevel() == 0:
		   enchant = str("")
		 else:
		   enchant = " +"+str(Item.getEnchantLevel())+""
		 htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step1next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + "["+str(pgrade)+"] " + enchant + "</a></td></tr>"
	   except :
		 try : listitems.close()
		 except : pass
	 try :
	   con.close()
	 except :
	   pass
 htmltext += u"</table><br><a action=\"bypass -h Quest q8015_Enchex spusok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event == "jewerly":
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0442\u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br><br><table width=300>"
 st.set("type","3")
 for Item in st.getPlayer().getInventory().getItems():
   itemTemplate = Item.getItem()
   idtest = Item.getItemId()
   itemType = Item.getItem().getType2()
   grade = itemTemplate.getCrystalType()
   if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itemType == L2Item.TYPE2_ACCESSORY and Item.getEnchantLevel() > 0:
	 con=L2DatabaseFactory.getInstance().getConnection()
	 listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
	 listitems.setInt(1, idtest)
	 rs=listitems.executeQuery()
	 while (rs.next()) :
	   icon=rs.getString("itemIcon")
	   try :
		 grades = {1: "D", 2: "C", 3: "B", 4: "A", 5: "S"}
		 pgrade = grades.get(grade, str(""))
		 if Item.getEnchantLevel() == 0:
		   enchant = str("")
		 else:
		   enchant = " +"+str(Item.getEnchantLevel())+""
		 htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step1next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + "["+str(pgrade)+"] " + enchant + "</a></td></tr>"
	   except :
		 try : listitems.close()
		 except : pass  
	 try :
	   con.close()
	 except :
	   pass
 htmltext += u"</table><br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step1next_"):
 itemObjId = int(event.replace("step1next_", ""))
 Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
 itemTemplate = Item.getItem()
 if Item and itemTemplate.getDuration() == -1 and Item.getEnchantLevel() > 0:
   grade = itemTemplate.getCrystalType()
   idtest = Item.getItemId()
   con=L2DatabaseFactory.getInstance().getConnection()
   listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
   listitems.setInt(1, idtest)
   rs=listitems.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 try :
	   st.set("enchant",str(Item.getEnchantLevel()))
	   st.set("oneitem",str(itemObjId))
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext =  u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0442\u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br>"
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	   payment = int(Item.getEnchantLevel()*COST)
	   if st.getQuestItemsCount(ITEM) < payment:
		 htmltext += u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430: <font color=ff2400>"+str(payment)+"</font> "+INAME+"<br>"
	   else:
		 htmltext += u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430: <font color=adff2f>"+str(payment)+"</font> "+INAME+"<br>"
		 htmltext += u"<button value=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c\" action=\"bypass -h Quest q8015_Enchex step2\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
	   htmltext += u"<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
	 except :
	   try : listitems.close()
	   except : pass
   try :
	 con.close()
   except :
	 pass
 else :
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event == "step2":
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br><br><table width=300>"
 itemType = st.getInt("type")
 if itemType == 0:
   TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"]
 elif itemType == 1:
   TYPES = ["Light","Heavy","Magic"]
 weapon1 = st.getInt("oneitem")
 for Item in st.getPlayer().getInventory().getItems():
   itemTemplate = Item.getItem()
   idtest = Item.getItemId()
   itype = str(Item.getItemType())
   grade = itemTemplate.getCrystalType()
   if itemType == 0 or itemType == 1:
	 if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itype in TYPES and Item.getObjectId() != weapon1:
	   con=L2DatabaseFactory.getInstance().getConnection()
	   listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
	   listitems.setInt(1, idtest)
	   rs=listitems.executeQuery()
	   while (rs.next()) :
		 icon=rs.getString("itemIcon")
		 try :
		   grades = {1: "[D]", 2: "[C]", 3: "[B]", 4: "[A]", 5: "[S]"}
		   pgrade = grades.get(grade, str(""))
		   if Item.getEnchantLevel() == 0:
			 enchant = str("")
		   else:
			 enchant = " +"+str(Item.getEnchantLevel())+""
		   htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step2next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + ""+str(pgrade)+" " + enchant + "</a></td></tr>"
		 except :
		   try : listitems.close()
		   except : pass
	   try :
		 con.close()
	   except :
		 pass
   elif itemType == 3:
	 itemType2 = Item.getItem().getType2()
	 if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itemType2 == L2Item.TYPE2_ACCESSORY and Item.getObjectId() != weapon1:
	   con=L2DatabaseFactory.getInstance().getConnection()
	   listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
	   listitems.setInt(1, idtest)
	   rs=listitems.executeQuery()
	   while (rs.next()) :
		 icon=rs.getString("itemIcon")
		 try :
		   grades = {1: "[D]", 2: "[C]", 3: "[B]", 4: "[A]", 5: "[S]"}
		   pgrade = grades.get(grade, str(""))
		   if Item.getEnchantLevel() == 0:
			 enchant = str("")
		   else:
			 enchant = " +"+str(Item.getEnchantLevel())+""
		   htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step2next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + ""+str(pgrade)+" " + enchant + "</a></td></tr>"
		 except :
		   try : listitems.close()
		   except : pass
	   try :
		 con.close()
	   except :
		 pass
 htmltext += u"</table><br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step2next_"):
 itemObjId = int(event.replace("step2next_", ""))
 obj = str(itemObjId)
 Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
 itemTemplate = Item.getItem()
 if Item and itemTemplate.getDuration() == -1:
   grade = itemTemplate.getCrystalType()
   idtest = Item.getItemId()
   con=L2DatabaseFactory.getInstance().getConnection()
   listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
   listitems.setInt(1, idtest)
   rs=listitems.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 try :
	   st.set("twoitem",obj)  
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext =  u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u0412 \u044d\u0442\u043e \u043e\u0440\u0443\u0436\u0438\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br>"
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	   htmltext += u"<button value=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c\" action=\"bypass -h Quest q8015_Enchex step3\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
	   htmltext += u"<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
	 except :
	   try : listitems.close()
	   except : pass
   try :
	 con.close()
   except :
	 pass
 else :
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step3"):
 weapon1 = st.getInt("oneitem")
 weapon2 = st.getInt("twoitem")
 htmltext =  u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0435?<br>"
 htmltext += u"\u0421 \u044d\u0442\u043e\u0433\u043e \u043e\u0440\u0443\u0436\u0438\u044f:"
 Item = st.getPlayer().getInventory().getItemByObjectId(weapon1)
 itemTemplate = Item.getItem()
 if Item:
   grade = itemTemplate.getCrystalType()
   idtest = Item.getItemId()
   con=L2DatabaseFactory.getInstance().getConnection()
   listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
   listitems.setInt(1, idtest)
   rs=listitems.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 try :
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	   payment = int(Item.getEnchantLevel()*COST)
	   if st.getQuestItemsCount(ITEM) < payment:
		 htmltext += u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430: <font color=ff2400>"+str(payment)+"</font> "+INAME+"<br>"
	   else:
		 htmltext += u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430: <font color=adff2f>"+str(payment)+"</font> "+INAME+"<br>"
	 except :
	   try : listitems.close()
	   except : pass
   try :
	 con.close()
   except :
	 pass
 htmltext += "Ha eTo:<br>"
 Item = st.getPlayer().getInventory().getItemByObjectId(weapon2)
 itemTemplate = Item.getItem()
 if Item:
   grade = itemTemplate.getCrystalType()
   idtest = Item.getItemId()
   cons=L2DatabaseFactory.getInstance().getConnection()
   listitemss=cons.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
   listitemss.setInt(1, idtest)
   rs=listitemss.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 try :
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	 except :
	   try : listitemss.close()
	   except : pass
   try :
	 cons.close()
   except :
	 pass
   htmltext += u"<button value=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c\" action=\"bypass -h Quest q8015_Enchex step4\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
 else :
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step4"):
 htmltext =  u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435...<br><br>"
 ench = st.getInt("enchant")
 payment = int(ench*COST)
 if st.getQuestItemsCount(ITEM) < payment:
   htmltext += u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430: <font color=ff2400>"+str(payment)+"</font> "+INAME+"<br>"
   return htmltext
#<
 weapon1 = st.getInt("oneitem")
 weapon2 = st.getInt("twoitem")
 item1 = st.getPlayer().getInventory().getItemByObjectId(weapon1)
 item2 = st.getPlayer().getInventory().getItemByObjectId(weapon2)
 if item1 == None or item2 == None:
   st.set("enchant","0")  
   htmltext += u"<font color=ff2400>\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430.</font><br>"
   return htmltext
 itemType = st.getInt("type")
 itype1 = str(item1.getItemType())
 itype2 = str(item2.getItemType())
 grade1 = item1.getItem().getCrystalType()
 grade2 = item2.getItem().getCrystalType()
#<
 if item1.getEnchantLevel() != ench:
   st.set("enchant","0")  
   htmltext += u"<font color=ff2400>\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430.</font><br>"
   return htmltext
#< 
 if grade1 != 5 or grade2 != 5:
   st.set("enchant","0")  
   htmltext += u"<font color=ff2400>\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430.</font><br>"
   return htmltext
#<  
 if itemType == 0:
   TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"]
   if itype1 not in TYPES or itype2 not in TYPES:
	 st.set("enchant","0")  
	 htmltext += u"<font color=ff2400>\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430.</font><br>"
	 return htmltext
 elif itemType == 1:
   TYPES = ["Light","Heavy","Magic"]
   if itype1 not in TYPES or itype2 not in TYPES:
	 st.set("enchant","0")  
	 htmltext += u"<font color=ff2400>\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430.</font><br>"
	 return htmltext
 elif itemType == 3:
   jew1 = item1.getItem().getType2()
   jew2 = item2.getItem().getType2()
   if jew1 != L2Item.TYPE2_ACCESSORY or jew2 != L2Item.TYPE2_ACCESSORY:
	 st.set("enchant","0")  
	 htmltext += u"<font color=ff2400>\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430.</font><br>"
	 return htmltext
 else:
   htmltext += u"<font color=ff2400>\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430.</font><br>"
   return htmltext
#< 
 st.takeItems(ITEM,payment)
#<
 slott = item1.getEquipSlot()
 if slott > 0:
   testt = player.getInventory().getPaperdollItem(slott)
   player.getInventory().unEquipItemInSlotAndRecord(slott)
   item1.setEnchantLevel(0)
   player.getInventory().equipItemAndRecord(testt)
   iut = InventoryUpdate()
   iut.addModifiedItem(testt)
   player.sendPacket(iut)
   player.broadcastPacket(CharInfo(player))
   player.sendPacket(UserInfo(player))
 else:
   item1.setEnchantLevel(0)
   player.sendPacket(ItemList(player, False))
#<
 slot = item2.getEquipSlot()
 if slot > 0:
   test = player.getInventory().getPaperdollItem(slot)
   player.getInventory().unEquipItemInSlotAndRecord(slot)
   item2.setEnchantLevel(ench)
   player.getInventory().equipItemAndRecord(test)
   iu = InventoryUpdate()
   iu.addModifiedItem(test)
   player.sendPacket(iu)
   player.broadcastPacket(CharInfo(player))
   player.sendPacket(UserInfo(player))
 else:
   item2.setEnchantLevel(ench)
   player.sendPacket(ItemList(player, False))
 htmltext += u"<font color=bef574>[ +"+str(ench)+"]</font> "u"\u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d\u043e.<br>"
  else:
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>Oops!</body></html>"
  return htmltext

def onTalk (self,npc,player):
  st = player.getQuestState(qn)
  npcId = npc.getNpcId()
  if npcId == NPC:
 htmltext = "privetstvie.htm"
  return htmltext

QUEST	   = Quest(8015,qn,"custom")

QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

917_Clan

__init__.py

 

import sys
from net.sf.l2j.gameserver.model import L2Skill
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
from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
from net.sf.l2j.gameserver.datatables import SkillTable
from net.sf.l2j.gameserver.network.serverpackets import PledgeSkillList
from net.sf.l2j.gameserver.network.serverpackets import PledgeShowInfoUpdate
from net.sf.l2j.gameserver.network.serverpackets import SystemMessage
from java.lang import Integer

#################
qn = "917_Clan"	#
NPC = 300300	#
#################

#########################################
#	   Управление лвл-ом клана		#
#########################################
Item1 = 4037	# ID Итема		#
Name1 = "CoL"	# Имя Итема		#
Count1 = 10	# Цена	за 6 лвл клана	#
Count2 = 15	# Цена	за 7 лвл клана	#
Count3 = 20	# Цена	за 8 лвл клана	#
#########################################

#########################################
#	 Управление репутацией клана	#
#########################################
Item2 = 4037	# ID Итема		#
Name2 = "CoL"	# Имя Итема		#
Count4 = 5	# Цена	50к репутации	#
Count5 = 10	# Цена	100к репутации	#
#########################################

#########################################
#	  Управление скиллами клана	#
#########################################
Item3 = 4037	# ID Итема		#
Name3 = "CoL"	# Имя Итема		#
Count6 = 20	# Цена	за клан скиллы	#
#########################################

print "Loaded: 913_Clan - OK"

class Quest (JQuest) :

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

def onAdvEvent(self, event, npc, player) :
	st = player.getQuestState(qn)
	htmltext = event
	xCLANx = 0
	eventSplit = event.split(" ")
	event = eventSplit[0]
	try :
		xCLANx = Integer.parseInt(eventSplit[1])
	except :
		htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
		htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
		htmltext += u"<font color=\"LEVEL\">\u0412\u044b \u043d\u0435 \u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u0432\u0435\u043b\u0438 \u0432 \u043f\u043e\u043b\u0435 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
		htmltext += u"<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
		htmltext += "</center></body></html>"
		return htmltext

	if event == "level":
		if xCLANx == 6 :
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">6 LvL \u043a\u043b\u0430\u043d\u0430 \u0441\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(Count1)+"</font> <font color=\"LEVEL\">"+Name1+" !</font>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c LvL\" action=\"bypass -h Quest 917_Clan lvl 6\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
			htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
			htmltext += "</center></body></html>"
			st.playSound("ItemSound.quest_accept")
		elif xCLANx == 7 :
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">7 LvL \u043a\u043b\u0430\u043d\u0430 \u0441\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(Count2)+"</font> <font color=\"LEVEL\">"+Name1+" !</font>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c LvL\" action=\"bypass -h Quest 917_Clan lvl 7\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
			htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
			htmltext += "</center></body></html>"
			st.playSound("ItemSound.quest_accept")
		elif xCLANx == 8 :
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">8 LvL \u043a\u043b\u0430\u043d\u0430 \u0441\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(Count3)+"</font> <font color=\"LEVEL\">"+Name1+" !</font>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c LvL\" action=\"bypass -h Quest 917_Clan lvl 8\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
			htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
			htmltext += "</center></body></html>"
			st.playSound("ItemSound.quest_accept")
		else:
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 6,7,8 LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "</center></body></html>"
			st.exitQuest(1)
		return htmltext

	if event == "lvl":
		if not st.getPlayer().isClanLeader() :
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c LvL \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0434\u0435\u0440 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
		elif st.getPlayer().getClan().getLevel() >= 8 :
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
		elif xCLANx == 6 :
			if st.getQuestItemsCount(Item1) < Count1 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			elif st.getPlayer().getClan().getLevel() >= 7 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043d\u0438\u0437\u0438\u0442\u044c LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			elif st.getPlayer().getClan().getLevel() >= 6 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f 6 LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.takeItems(Item1,Count1)
			st.getPlayer().getClan().changeLevel(6)
			st.getPlayer().getClan().broadcastToOnlineMembers(PledgeShowInfoUpdate(st.getPlayer().getClan()))
			st.playSound("ItemSound.quest_finish")
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 6 LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.exitQuest(1)
		elif xCLANx == 7 :
			if st.getQuestItemsCount(Item1) < Count2 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			elif st.getPlayer().getClan().getLevel() >= 7 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f 7 LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.takeItems(Item1,Count2)
			st.getPlayer().getClan().changeLevel(7)
			st.getPlayer().getClan().broadcastToOnlineMembers(PledgeShowInfoUpdate(st.getPlayer().getClan()))
			st.playSound("ItemSound.quest_finish")
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 7 LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.exitQuest(1)
		elif xCLANx == 8 :
			if st.getQuestItemsCount(Item1) < Count3 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.takeItems(Item1,Count3)
			st.getPlayer().getClan().changeLevel(8)
			st.getPlayer().getClan().broadcastToOnlineMembers(PledgeShowInfoUpdate(st.getPlayer().getClan()))
			st.playSound("ItemSound.quest_finish")
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 8 LvL \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.exitQuest(1)

	if event == "reput":
		if xCLANx == 50000 :
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">50k \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u0438 \u0441\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(Count4)+"</font> <font color=\"LEVEL\">"+Name2+" !</font>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u044e\" action=\"bypass -h Quest 917_Clan rep 50000\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
			htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
			htmltext += "</center></body></html>"
			st.playSound("ItemSound.quest_accept")
		elif xCLANx == 100000 :
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">100k \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u0438 \u0441\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(Count5)+"</font> <font color=\"LEVEL\">"+Name2+" !</font>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u044e\" action=\"bypass -h Quest 917_Clan rep 100000\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
			htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
			htmltext += "</center></body></html>"
			st.playSound("ItemSound.quest_accept")
		else:
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 50k \u0438\u043b\u0438 100k \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u0438 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "</center></body></html>"
			st.exitQuest(1)
		return htmltext

	if event == "rep":
		if xCLANx == 50000 :
			if st.getQuestItemsCount(Item1) < Count4 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.takeItems(Item1,Count4)
			st.getPlayer().getClan().setReputationScore(st.getPlayer().getClan().getReputationScore()+50000,True)
			st.getPlayer().getClan().broadcastToOnlineMembers(PledgeShowInfoUpdate(st.getPlayer().getClan()))
			st.playSound("ItemSound.quest_finish")
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 50k \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u0438 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.exitQuest(1)
		elif xCLANx == 100000 :
			if st.getQuestItemsCount(Item1) < Count5 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.takeItems(Item1,Count5)
			st.getPlayer().getClan().setReputationScore(st.getPlayer().getClan().getReputationScore()+100000,True)
			st.getPlayer().getClan().broadcastToOnlineMembers(PledgeShowInfoUpdate(st.getPlayer().getClan()))
			st.playSound("ItemSound.quest_finish")
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 100k \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u0438 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.exitQuest(1)

	if event == "skill":
		if xCLANx == 9999 :
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">\u0412\u0441\u0435 \u043a\u043b\u0430\u043d \u0441\u043a\u0438\u043b\u043b\u044b \u0441\u0442\u043e\u044f\u0442:</font> <font color=\"FF0000\">"+str(Count6)+"</font> <font color=\"LEVEL\">"+Name3+" !</font>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043a\u0438\u043b\u043b\u044b\" action=\"bypass -h Quest 917_Clan skills 8888\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
			htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
			htmltext += "</center></body></html>"
			st.playSound("ItemSound.quest_accept")
		else:
			htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
			htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<font color=\"LEVEL\">\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043a\u0438\u043b\u043b\u044b,<br>\u0412 \u043f\u043e\u043b\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
			htmltext += u"<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
			htmltext += "</center></body></html>"
			st.exitQuest(1)
		return htmltext

	if event == "skills":
		if xCLANx == 8888 :
			if st.getQuestItemsCount(Item3) < Count6 :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			elif not st.getPlayer().isClanLeader() :
				return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0422\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0434\u0435\u0440 \u043a\u043b\u0430\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043a\u0438\u043b\u043b\u044b !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.takeItems(Item3,Count6)
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(370,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(371,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(372,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(373,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(374,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(375,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(376,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(377,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(378,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(379,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(380,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(381,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(382,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(383,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(384,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(385,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(386,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(387,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(388,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(389,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(390,3))
			st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(391,1))
			st.getPlayer().getClan().broadcastToOnlineMembers(PledgeSkillList(st.getPlayer().getClan()))
			st.playSound("ItemSound.quest_finish")
			return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u0441\u0435 \u043a\u043b\u0430\u043d \u0441\u043a\u0438\u043b\u043b\u044b !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
			st.exitQuest(1)

def onTalk(self, npc, player) :
	htmltext = u"<html><title>Exclusive Shop</title><body><br><br><center><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u041c\u043d\u0435 \u043d\u0435 \u0447\u0435\u0433\u043e \u0432\u0430\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=center><br><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></body></html>"
	st = player.getQuestState(qn)
	if not st :
		st = self.newQuestState(player)
	elif not player.getClan():
		return u"<html><title>Exclusive Shop</title><body><center><br><br><img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435\u0442\u0443 \u043a\u043b\u0430\u043d\u0430 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table></center></body></html>"
	clanlvl = str(st.getPlayer().getClan().getLevel())
	reputation = str(st.getPlayer().getClan().getReputationScore())
	htmltext = "<html><title>Exclusive Shop</title><body><center><br>"
	htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>"
	htmltext += u"<table width=150><tr><td align=center><font color=\"FF0000\">..:: \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u043b\u0430\u043d\u0435 ::..</font></td></tr>"
	htmltext += u"<tr><td align=center>LvL \u043a\u043b\u0430\u043d\u0430: <font color=\"LEVEL\">"+clanlvl+"</font></td></tr>"
	htmltext += u"<tr><td align=center>\u041e\u0447\u043a\u043e\u0432 \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u0438: <font color=\"LEVEL\">"+reputation+"</font></td></tr></table>"
	htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
	htmltext += u"<table width=140><tr><td align=center>\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e:</td><td align=center><edit var=\"name\" width=45 length=6></td></tr></table><br>"
	htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c LvL \u043a\u043b\u0430\u043d\u0430\" action=\"bypass -h Quest 917_Clan level $name no_name\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
	htmltext += u"<tr><td align=center><button value=\"\u041f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0440\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u044e\" action=\"bypass -h Quest 917_Clan reput $name no_name\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
	htmltext += u"<tr><td align=center><button value=\"\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043a\u0438\u043b\u043b\u044b\" action=\"bypass -h Quest 917_Clan skill 9999\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr></table>"
	htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
	htmltext += "</center></body></html>"
	return htmltext

QUEST	= Quest(917,qn,"custom")

QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

919_Enchanter

__init__.py

 

import sys
from java.lang import String
from java.lang import Integer
from net.sf.l2j.util import Rnd
from net.sf.l2j import L2DatabaseFactory
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model import L2ItemInstance
from net.sf.l2j.gameserver.network.serverpackets import ItemList
from net.sf.l2j.gameserver.network.serverpackets import UserInfo
from net.sf.l2j.gameserver.network.serverpackets import CharInfo
from net.sf.l2j.gameserver.network.serverpackets import InventoryUpdate
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

Qn = "919_Enchanter"
Npc = 300300

MaxEnchantWeapon = 20 # Макс.заточка оружия
MaxEnchantArmor = 15  # Макс.заточка брони
MaxEnchantJewel = 15  # Макс.заточка бижутерии

Adena = 4037 # Id валюты

JPrice = [0,1,2,3,4,5] # Цены за заточку к биже +1
JPrice10 = [6,7,8,9,10,11] # Цена за заточку к биже +10
JPriceRnd = [12,13,14,15,16,17] # Цена за рандомную заточку бижи

APrice = [0,1,2,3,4,6] # Цены за заточку к броне +1
APrice10 = [6,7,8,9,10,11] # Цена за заточку к броне +10
APriceRnd = [12,13,14,15,16,17] # Цена за рандомную заточку брони

WPrice = [0,1,2,3,4,7] # Цены за заточку к оружию +1
WPrice10 = [6,7,8,9,10,11] # Цена за заточку к оружию +10
WPriceRnd = [12,13,14,15,16,17] # Цена за рандомную заточку оружия

Jewel = ["None"]
Armor = ["Light","Heavy","Magic"]
Weapon = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt","Shield"]

SlotForEnchant = [7,8,6,10,11,9,12,3,1,2,4,5] # Какие слоты можно точить [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
NoEnchantItem = [] # Id запрещенных вещей для заточки


def getItemIcon(ItemId):
 con=L2DatabaseFactory.getInstance().getConnection()
 II=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
 II.setInt(1, ItemId)
 rs=II.executeQuery()
 ItemIcon = ""
 if rs.next() :
ItemIcon = rs.getString("itemIcon")
 else :
ItemIcon = "icon.etc_adena_i00"
 try :
con.close()
 except :
pass
 return ItemIcon

def validateItem(ItemId) :
 for itm in NoEnchantItem :
if itm == ItemId :
  return False
 return True

def getHexSlot(Slot) :
 if Slot == 0 :
return 0x01
 elif Slot == 1 :	# Левая серьга
return 0x04
 elif Slot == 2 :	# Правая серьга
return 0x02
 elif Slot == 3 :	# Ожирелье
return 0x08
 elif Slot == 4 :	# Левое колльцо
return 0x20
 elif Slot == 5 :	# Правое кольцо
return 0x10
 elif Slot == 6 :	# Шлем
return 0x40
 elif Slot == 7 :	# Левая рука
return 0x80
 elif Slot == 8 :	# Правая рука
return 0x0100
 elif Slot == 9 :	# Перчатки
return 0x0200
 elif Slot == 10 :	# Верх брони
return 0x0400
 elif Slot == 11 :	# Низ брони
return 0x0800
 elif Slot == 12 :	# Ботинки
return 0x1000
 elif Slot == 13 :	#
return 0x2000
 elif Slot == 14 :	# Левая/правая рука
return 0x4000
 elif Slot == 15 :	#
return 0x040000
 elif Slot == 16 :	#
return 0x010000
 elif Slot == 17 :	#
return 0x080000
 return 0x00

print "Loaded: 919_Enchanter - OK"

class Quest (JQuest) :

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

 def onTalk (Self,npc,player) :
st = player.getQuestState(Qn)
npcId = npc.getNpcId()
htmltext = u"<html><title>Donate Shop</title><body><br><br><br><center>\u041c\u043d\u0435 \u043d\u0435 \u0447\u0435\u0433\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c !</center></body></html>"
if not st : return htmltext
htmltext = u"<html><title>Donate Shop</title><body><center><br><font color=\"00FF00\">\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0435\u0449\u044c \u043a\u0430\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u0430\u0442\u043e\u0447\u0438\u0442\u044c<br>"
for Slot in SlotForEnchant :
  Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(Slot))
  if Item1 != None :
	if validateItem(Item1.getItemId()) :
	  Grade = Item1.getItem().getCrystalType()
	  if Grade not in [0] :
		if Grade == 1:
		  pgrade = str("[D]")
		elif Grade == 2:
		  pgrade = str("[C]")
		elif Grade == 3:
		  pgrade = str("[B]")
		elif Grade == 4:
		  pgrade = str("[A]")
		elif Grade == 5:
		 pgrade = str("[S]")
		else:
		  pgrade = str("")
		htmltext = htmltext + "<img src=\"" + getItemIcon(Item1.getItemId()) + "\" width=32 height=32><a action=\"bypass -h Quest 919_Enchanter slot_" + str(Slot) + "\">" + Item1.getItemName() + " " + str(pgrade) + " +" + str(Item1.getEnchantLevel()) + "</a><br>"
htmltext = htmltext + "</font></center></body></html>"
return htmltext

 def onAdvEvent (self,event,npc,player) :
st = player.getQuestState(Qn)
htmltext = u"<html><title>Donate Shop</title><body><br><br><br><center>\u041c\u043d\u0435 \u043d\u0435 \u0447\u0435\u0433\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c !</center></body></html>"
if not st : return htmltext
strEvent = String(event)
if strEvent.startsWith("slot") :
  intEvent = Integer.parseInt(strEvent.substring(5))
  htmltext = "<html><title>Donate Shop</title><body><br><center>"
  Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent))
  if Item1 != None :
	if validateItem(Item1.getItemId()) :
	  ItemEnchant = Item1.getEnchantLevel()
	  htmltext = htmltext + "<img src=\"" + getItemIcon(Item1.getItemId()) + "\" width=32 height=32><br>"
	  htmltext = htmltext + u"\u0418\u043c\u044f: " + Item1.getItemName() + "<br>"
	  htmltext = htmltext + u"\u0417\u0430\u0442\u043e\u0447\u043a\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 : " + str(ItemEnchant) + "<br>"
	  Grade = Item1.getItem().getCrystalType()
	  Itype = str(Item1.getItemType())
	  if Itype in Jewel and ItemEnchant < MaxEnchantJewel :
		if ItemEnchant < MaxEnchantJewel :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c +1 : " + str(JPrice[Grade]) + "<br>"
		if ItemEnchant + 10 <= MaxEnchantJewel :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c +10 : " + str(JPrice10[Grade]) + "<br>"
		if ItemEnchant < MaxEnchantJewel :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0435\u043d\u0434\u043e\u043c\u0430 : " + str(JPriceRnd[Grade]) + "<br><br>"
		if ItemEnchant < MaxEnchantJewel :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c +1 \u043a \u0437\u0430\u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430</a><br>"
		if ItemEnchant + 10 <= MaxEnchantJewel :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusten_" + str(intEvent) + u"\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c +10 \u043a \u0437\u0430\u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430</a><br>"
		if ItemEnchant < MaxEnchantJewel :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter rnd_" + str(intEvent) + u"\">\u0418\u0441\u043f\u044b\u0442\u0430\u0442\u044c \u0443\u0434\u0430\u0447\u0443 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0437\u0430\u0442\u043e\u0447\u043a\u043e\u0439</a>"
	  elif Itype in Armor and ItemEnchant < MaxEnchantArmor :
		if ItemEnchant < MaxEnchantArmor :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c +1 : " + str(APrice[Grade]) + "<br>"
		if ItemEnchant + 10 <= MaxEnchantArmor :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c +10 : " + str(APrice10[Grade]) + "<br>"
		if ItemEnchant < MaxEnchantArmor :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0435\u043d\u0434\u043e\u043c\u0430 : " + str(APriceRnd[Grade]) + "<br><br>"
		if ItemEnchant < MaxEnchantArmor :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c +1 \u043a \u0437\u0430\u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430</a><br>"
		if ItemEnchant + 10 <= MaxEnchantArmor :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusten_" + str(intEvent) + u"\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c +10 \u043a \u0437\u0430\u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430</a><br>"
		if ItemEnchant < MaxEnchantArmor :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter rnd_" + str(intEvent) + u"\">\u0418\u0441\u043f\u044b\u0442\u0430\u0442\u044c \u0443\u0434\u0430\u0447\u0443 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0437\u0430\u0442\u043e\u0447\u043a\u043e\u0439</a>"
	  elif Itype in Weapon and ItemEnchant < MaxEnchantWeapon :
		if ItemEnchant < MaxEnchantWeapon :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c +1 : " + str(WPrice[Grade]) + "<br>"
		if ItemEnchant + 10 <= MaxEnchantWeapon :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c +10 : " + str(WPrice10[Grade]) + "<br>"
		if ItemEnchant < MaxEnchantWeapon :
		  htmltext = htmltext + u"\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0435\u043d\u0434\u043e\u043c\u0430 : " + str(WPriceRnd[Grade]) + "<br><br>"
		if ItemEnchant < MaxEnchantWeapon :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c +1 \u043a \u0437\u0430\u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430</a><br>"
		if ItemEnchant + 10 <= MaxEnchantWeapon :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusten_" + str(intEvent) + u"\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c +10 \u043a \u0437\u0430\u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430</a><br>"
		if ItemEnchant < MaxEnchantWeapon :
		  htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter rnd_" + str(intEvent) + u"\">\u0418\u0441\u043f\u044b\u0442\u0430\u0442\u044c \u0443\u0434\u0430\u0447\u0443 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0437\u0430\u0442\u043e\u0447\u043a\u043e\u0439</a>"
	else :
	  htmltext = htmltext + u"\u042d\u0442\u0443 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f"
  else :
	htmltext = htmltext + u"\u0412\u044b \u0441\u043d\u044f\u043b\u0438 \u0432\u0435\u0449\u044c \u043f\u043e\u043a\u0430 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0436\u0430\u043b\u0438"
elif strEvent.startsWith("plusone") :
  intEvent = Integer.parseInt(strEvent.substring(8))
  htmltext = "<html><title>Donate Shop</title><body><br><br><br><center>"
  Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent))
  if Item1 != None :
	if validateItem(Item1.getItemId()) :
	  Grade = Item1.getItem().getCrystalType()
	  if Grade not in [0] :
		ItemEnchant = Item1.getEnchantLevel()
		Itype = str(Item1.getItemType())
		if Itype in Jewel :
		  if ItemEnchant < MaxEnchantJewel :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= JPrice[Grade]:
			  st.takeItems(Adena,JPrice[Grade])
			  Item1.setEnchantLevel(ItemEnchant+1)
	  ItemEnchant = Item1.getEnchantLevel()
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		elif Itype in Armor :
		  if ItemEnchant < MaxEnchantArmor :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= APrice[Grade]:
			  st.takeItems(Adena,APrice[Grade])
			  Item1.setEnchantLevel(ItemEnchant+1)
	  ItemEnchant = Item1.getEnchantLevel()
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		elif Itype in Weapon :
		  if ItemEnchant < MaxEnchantWeapon :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= WPrice[Grade]:
			  st.takeItems(Adena,WPrice[Grade])
			  Item1.setEnchantLevel(ItemEnchant+1)
	  ItemEnchant = Item1.getEnchantLevel()
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		else :
		  htmltext = htmltext + u"\u042f \u043d\u0435 \u043c\u043e\u0433\u0443 \u0437\u0430\u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 !"
	  else :
		htmltext = htmltext + u"<font color=LEVEL>[NG]</font> \u0432\u0435\u0449\u0438 \u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f !"
	else :
	  htmltext = htmltext + u"\u042d\u0442\u0443 \u0432\u0435\u0449\u044c \u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f !"
  else :
	htmltext = htmltext + u"\u0412\u044b \u0441\u043d\u044f\u043b\u0438 \u0432\u0435\u0449\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0442\u043e\u0447\u043a\u0438 !"
elif strEvent.startsWith("plusten") :
  intEvent = Integer.parseInt(strEvent.substring(8))
  htmltext = "<html><title>Donate Shop</title><body><br><br><br><center>"
  Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent))
  if Item1 != None :
	if validateItem(Item1.getItemId()) :
	  Grade = Item1.getItem().getCrystalType()
	  if Grade not in [0] :
		ItemEnchant = Item1.getEnchantLevel()
		Itype = str(Item1.getItemType())
		if Itype in Jewel :
		  if ItemEnchant+10 < MaxEnchantJewel+1 :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= JPrice10[Grade]:
			  st.takeItems(Adena,JPrice10[Grade])
			  Item1.setEnchantLevel(ItemEnchant+10)
	  ItemEnchant = Item1.getEnchantLevel()
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		elif Itype in Armor :
		  if ItemEnchant+10 < MaxEnchantArmor+1 :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= APrice10[Grade]:
			  st.takeItems(Adena,APrice10[Grade])
			  Item1.setEnchantLevel(ItemEnchant+10)
	  ItemEnchant = Item1.getEnchantLevel()
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		elif Itype in Weapon :
		  if ItemEnchant+10 < MaxEnchantWeapon+1 :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= WPrice10[Grade]:
			  st.takeItems(Adena,WPrice10[Grade])
			  Item1.setEnchantLevel(ItemEnchant+10)
	  ItemEnchant = Item1.getEnchantLevel()
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		else :
		  htmltext = htmltext + u"\u042f \u043d\u0435 \u043c\u043e\u0433\u0443 \u0437\u0430\u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 !"
	  else :
		htmltext = htmltext + u"<font color=LEVEL>[NG]</font> \u0432\u0435\u0449\u0438 \u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f !"
	else :
	  htmltext = htmltext + u"\u042d\u0442\u0443 \u0432\u0435\u0449\u044c \u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f !"
  else :
	htmltext = htmltext + u"\u0412\u044b \u0441\u043d\u044f\u043b\u0438 \u0432\u0435\u0449\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0442\u043e\u0447\u043a\u0438 !"
elif strEvent.startsWith("rnd") :
  intEvent = Integer.parseInt(strEvent.substring(4))
  htmltext = "<html><title>Donate Shop</title><body><br><br><br><center>"
  Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent))
  if Item1 != None :
	if validateItem(Item1.getItemId()) :
	  Grade = Item1.getItem().getCrystalType()
	  if Grade not in [0] :
		ItemEnchant = Item1.getEnchantLevel()
		Itype = str(Item1.getItemType())
		if Itype in Jewel :
		  if ItemEnchant < MaxEnchantJewel :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= JPriceRnd[Grade]:
			  ItemEnchant = Rnd.get(MaxEnchantJewel)
			  st.takeItems(Adena,JPriceRnd[Grade])
			  Item1.setEnchantLevel(ItemEnchant)
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		elif Itype in Armor :
		  if ItemEnchant < MaxEnchantArmor :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= APriceRnd[Grade]:
			  ItemEnchant = Rnd.get(MaxEnchantArmor)
			  st.takeItems(Adena,APriceRnd[Grade])
			  Item1.setEnchantLevel(ItemEnchant)
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		elif Itype in Weapon :
		  if ItemEnchant < MaxEnchantWeapon :
			iu = InventoryUpdate()
			player.sendPacket(iu)
			player.broadcastPacket(CharInfo(player))
			player.sendPacket(UserInfo(player))
			if st.getQuestItemsCount(Adena) >= WPriceRnd[Grade]:
			  ItemEnchant = Rnd.get(MaxEnchantWeapon)
			  st.takeItems(Adena,WPriceRnd[Grade])
			  Item1.setEnchantLevel(ItemEnchant)
			  st.playSound("ItemSound.quest_itemget")
			  player.sendPacket(ItemList(player,False))
			  htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 <font color=FF0000>+" + str(ItemEnchant) + "</font> !"
			else :
			  htmltext = htmltext + u"\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !"
		  else :
			htmltext = htmltext + u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0449\u044c \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c !"
		else :
		  htmltext = htmltext + u"\u042f \u043d\u0435 \u043c\u043e\u0433\u0443 \u0437\u0430\u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 !"
	  else :
		htmltext = htmltext + u"<font color=LEVEL>[NG]</font> \u0432\u0435\u0449\u0438 \u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f !"
	else :
	  htmltext = htmltext + u"\u042d\u0442\u0443 \u0432\u0435\u0449\u044c \u0442\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f !"
  else :
	htmltext = htmltext + u"\u0412\u044b \u0441\u043d\u044f\u043b\u0438 \u0432\u0435\u0449\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0442\u043e\u0447\u043a\u0438 !"
htmltext = htmltext + "</font></center></body></html>"
return htmltext

QUEST	= Quest(919,Qn,"custom")

QUEST.addStartNpc(300300)
QUEST.addTalkId(300300)

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

q8014_LifeStone

__init__.py

 

import sys
from java.util import Iterator
from net.sf.l2j.util import Rnd
from net.sf.l2j.gameserver.network.serverpackets import SystemMessage
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
from net.sf.l2j import L2DatabaseFactory
from net.sf.l2j.gameserver.templates import L2EtcItemType
from net.sf.l2j.gameserver.templates import L2Item
from java.lang import System
from net.sf.l2j.gameserver.idfactory import IdFactory
from net.sf.l2j.gameserver.model import L2ItemInstance
from net.sf.l2j.gameserver.datatables import AugmentationData
from net.sf.l2j.gameserver.model import L2Augmentation
from net.sf.l2j.gameserver.network.serverpackets import ItemList
from net.sf.l2j.gameserver.model import L2Skill
from net.sf.l2j.gameserver.datatables import SkillTable

qn = "q8014_LifeStone"

#id нпц
NPC = 300300
#id итема для переноса
ITEM = 4037
#стоимость переноса
COST = 50
#список запрещенных итемов
FORBIDDEN = [6611,6612,6613,6614,6615,6616,6617,6618,6619,6620,6621]

print "Loaded: q8014_LifeStone - OK"

class Quest (JQuest) :

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

def onAdvEvent (self,event,npc,player):
  st = player.getQuestState(qn)
  if event == "spisok":
 if st.getQuestItemsCount(ITEM) < COST:
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421 \u0441\u0442\u043e\u0438\u0442<font color=74bff5>"+str(COST)+" Event Coin</font></body></html>"
   return htmltext
 htmltext = "<html><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI.SquareBlank\" width=260 height=2><br1>"	   
 htmltext += u"<table width=260><tr><td align=center><font color=LEVEL>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421</font></td></tr></table>"
 htmltext += u"<button value=\"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043e\u0440\u0443\u0436\u0438\u0435\" action=\"bypass -h Quest q8014_LifeStone step1\" width=80 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br1>"
 htmltext += "<center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32></center></body></html>"
  elif event == "step1":
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u041e\u0442\u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br><br><table width=300>"
 SPWEAPONS = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"]
 for Item in st.getPlayer().getInventory().getItems():
   itemTemplate = Item.getItem()
   idtest = Item.getItemId()
   itype = str(Item.getItemType())
   if idtest not in FORBIDDEN and Item.isAugmented() and not Item.isEquipped() and itype in SPWEAPONS:
	 cnt = Item.getCount()
	 count = str(cnt)
	 grade = itemTemplate.getCrystalType()   
	 con=L2DatabaseFactory.getInstance().getConnection()
	 listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
	 listitems.setInt(1, idtest)
	 rs=listitems.executeQuery()
	 while (rs.next()) :
	   icon=rs.getString("itemIcon")
	   try :
		 if grade == 1:
		   pgrade = str("[D]")
		 elif grade == 2:
		   pgrade = str("[C]")
		 elif grade == 3:
		   pgrade = str("[B]")
		 elif grade == 4:
		   pgrade = str("[A]")
		 elif grade == 5:
		   pgrade = str("[S]")
		 else:
		   pgrade = str("")
		 if Item.getEnchantLevel() == 0:
		   enchant = str("")
		 else:
		   enchant = " +"+str(Item.getEnchantLevel())+""
		 htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8014_LifeStone step1next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + ""+str(pgrade)+" " + enchant + "</a></td></tr>"
	   except :
		 try : insertion.close()
		 except : pass
	 try :
	   con.close()
	 except :
	   pass
 htmltext += u"</table><br><a action=\"bypass -h Quest q8014_LifeStone spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step1next_"):
 itemObjId = int(event.replace("step1next_", ""))
 obj = str(itemObjId)
 Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
 itemTemplate = Item.getItem()
 if Item and not Item.isEquipped():
   cnt = Item.getCount()
   count = str(cnt)
   grade = itemTemplate.getCrystalType()
   igrade = str(itemTemplate.getCrystalType())
   itype = str(Item.getItemType())
   idtest = Item.getItemId()
   con=L2DatabaseFactory.getInstance().getConnection()
   listitems=con.prepareStatement("SELECT itemIcon, skill, attributes FROM `z_market_icons` icon, `augmentations` aug WHERE icon.itemId=? AND aug.item_id=?")
   listitems.setInt(1, idtest)
   listitems.setInt(2, itemObjId)
   rs=listitems.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 skill=rs.getInt("skill")
	 attributes=rs.getInt("attributes")
	 try :
	   st.set("oneitem",obj)
	   st.set("skill",str(skill))
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0440\u0443\u0436\u0438\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br>"
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	   if skill != 0:
		 skill = SkillTable.getInstance().getInfo(skill, 1)
		 name = skill.getName()
		 htmltext += "<br><font color=bef574>["+str(name)+"]</font><br>"
		 htmltext += u"<button value=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c\" action=\"bypass -h Quest q8014_LifeStone step2\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
	   else:
		 htmltext += u"\u0412 \u044d\u0442\u043e\u043c \u043e\u0440\u0443\u0436\u0438\u0435 \u043d\u0435\u0442 \u0441\u043a\u0438\u043b\u043b\u0430"
		 htmltext += u"<br><a action=\"bypass -h Quest q8014_LifeStone spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
	 except :
	   try : listitems.close()
	   except : pass
   try :
	 con.close()
   except :
	 pass
 else :
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8014_LifeStone spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event == "step2":
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u041a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br><br><table width=300>"
 SPWEAPONS = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"]
 weapon1 = st.getInt("oneitem")
 for Item in st.getPlayer().getInventory().getItems():
   itemTemplate = Item.getItem()
   idtest = Item.getItemId()
   itype = str(Item.getItemType())
   if idtest not in FORBIDDEN and not Item.isEquipped() and itype in SPWEAPONS and Item.getObjectId() != weapon1 and not Item.isAugmented():
	 grade = itemTemplate.getCrystalType()   
	 con=L2DatabaseFactory.getInstance().getConnection()
	 listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
	 listitems.setInt(1, idtest)
	 rs=listitems.executeQuery()
	 while (rs.next()) :
	   icon=rs.getString("itemIcon")
	   try :
		 if grade == 1:
		   pgrade = str("[D]")
		 elif grade == 2:
		   pgrade = str("[C]")
		 elif grade == 3:
		   pgrade = str("[B]")
		 elif grade == 4:
		   pgrade = str("[A]")
		 elif grade == 5:
		   pgrade = str("[S]")
		 else:
		   pgrade = str("")
		 if Item.getEnchantLevel() == 0:
		   enchant = str("")
		 else:
		   enchant = " +"+str(Item.getEnchantLevel())+""
		 htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8014_LifeStone step2next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + ""+str(pgrade)+" " + enchant + "</a></td></tr>"
	   except :
		 try : insertion.close()
		 except : pass
	 try :
	   con.close()
	 except :
	   pass
 htmltext += u"</table><br><a action=\"bypass -h Quest q8014_LifeStone spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step2next_"):
 itemObjId = int(event.replace("step2next_", ""))
 obj = str(itemObjId)
 Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
 itemTemplate = Item.getItem()
 if Item and not Item.isAugmented() and not Item.isEquipped():
   cnt = Item.getCount()
   count = str(cnt)
   grade = itemTemplate.getCrystalType()
   igrade = str(itemTemplate.getCrystalType())
   itype = str(Item.getItemType())
   idtest = Item.getItemId()
   con=L2DatabaseFactory.getInstance().getConnection()
   listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
   listitems.setInt(1, idtest)
   rs=listitems.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 try :
	   st.set("twoitem",obj)
	   st.set("lcount",count)
	   st.set("grade",igrade)
	   st.set("type",itype)
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext =  u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u0412 \u044d\u0442\u043e \u043e\u0440\u0443\u0436\u0438\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c?<br>"
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	   htmltext += u"<button value=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c\" action=\"bypass -h Quest q8014_LifeStone step3\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
	   htmltext += u"<br><a action=\"bypass -h Quest q8014_LifeStone spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
	 except :
	   try : listitems.close()
	   except : pass
   try :
	 con.close()
   except :
	 pass
 else :
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8014_LifeStone spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step3"):
 weapon1 = st.getInt("oneitem")
 weapon2 = st.getInt("twoitem")
 skillp = st.getInt("skill")
 htmltext =  u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c?<br>"
 skill = SkillTable.getInstance().getInfo(skillp, 1)
 name = skill.getName()
 htmltext += "<font color=bef574>["+str(name)+"]</font><br>"
 htmltext += u"\u0438\u0437:"
 Item = st.getPlayer().getInventory().getItemByObjectId(weapon1)
 itemTemplate = Item.getItem()
 if Item and Item.isAugmented() and not Item.isEquipped():
   cnt = Item.getCount()
   count = str(cnt)
   grade = itemTemplate.getCrystalType()
   igrade = str(itemTemplate.getCrystalType())
   itype = str(Item.getItemType())
   idtest = Item.getItemId()
   con=L2DatabaseFactory.getInstance().getConnection()
   listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
   listitems.setInt(1, idtest)
   rs=listitems.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 try :
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	 except :
	   try : listitems.close()
	   except : pass
   try :
	 con.close()
   except :
	 pass
 htmltext += "6=B:<br>"
 Item = st.getPlayer().getInventory().getItemByObjectId(weapon2)
 itemTemplate = Item.getItem()
 if Item and not Item.isAugmented() and not Item.isEquipped():
   cnt = Item.getCount()
   count = str(cnt)
   grade = itemTemplate.getCrystalType()
   igrade = str(itemTemplate.getCrystalType())
   itype = str(Item.getItemType())
   idtest = Item.getItemId()
   cons=L2DatabaseFactory.getInstance().getConnection()
   listitemss=cons.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
   listitemss.setInt(1, idtest)
   rs=listitemss.executeQuery()
   while (rs.next()) :
	 icon=rs.getString("itemIcon")
	 try :
	   grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"}
	   pgrade = grades.get(grade, str(""))
	   enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("")
	   htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>"
	 except :
	   try : listitemss.close()
	   except : pass
   try :
	 cons.close()
   except :
	 pass
   htmltext += u"<button value=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c\" action=\"bypass -h Quest q8014_LifeStone step4\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
 else :
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8014_LifeStone spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>"
  elif event.startswith("step4"):
 weapon1 = st.getInt("oneitem")
 weapon2 = st.getInt("twoitem")
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>\u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...<br><br>"
 if st.getQuestItemsCount(ITEM) < COST:
   htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421 \u0441\u0442\u043e\u0438\u0442<font color=74bff5>"+str(COST)+" Event Coin</font></body></html>"
   return htmltext
 item2 = st.getPlayer().getInventory().getItemByObjectId(weapon2)
 item1 = st.getPlayer().getInventory().getItemByObjectId(weapon1)
 con=L2DatabaseFactory.getInstance().getConnection()
 listitems=con.prepareStatement("SELECT * FROM `augmentations` WHERE item_id=?")
 listitems.setInt(1, weapon1)
 rs=listitems.executeQuery()
 while (rs.next()) :
   attributes=rs.getInt("attributes")
   skill=rs.getInt("skill")
   try :
	 st.takeItems(ITEM,COST)
	 item2.setAugmentation(L2Augmentation(item2, attributes, skill, 10, True))
	 player.sendPacket(ItemList(player, False))
	 item1.removeAugmentation()
	 skilla = SkillTable.getInstance().getInfo(skill, 1)
	 name = skilla.getName()
	 htmltext += u"<font color=bef574>["+str(name)+"]</font> "u"\u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043d.<br>"
   except :
	 try : listitems.close()
	 except : pass
 try :
   con.close()
 except :
   pass
  else:
 htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u041b\u0421:<br>Oops!</body></html>"
  return htmltext

def onTalk (self,npc,player):
  st = player.getQuestState(qn)
  npcId = npc.getNpcId()
  if npcId == NPC:
 htmltext = "privetstvie.htm"
  return htmltext

QUEST	   = Quest(8014,qn,"custom")

QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Ты хочешь все и сразу. Учись пока маленький работать сам и понимать что делаешь. Ибо потом привыкнешь. За тебя никто не будет делать.

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
Ты хочешь все и сразу. Учись пока маленький работать сам и понимать что делаешь. Ибо потом привыкнешь. За тебя никто не будет делать.

:friends: Солидарен.

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Импорты + сказано, что отличается там на 1 таблицу! Читайте сначала:)

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...