Скрытый текстimport sys from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance from java.util import Iterator from com.l2jfrozen.gameserver.datatables import SkillTable from com.l2jfrozen.util.database import L2DatabaseFactory from com.l2jfrozen.gameserver.model.quest import State from com.l2jfrozen.gameserver.model.quest import QuestState from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest ################### qn = "50301_Hero" # NPC = 300300 # ################### ############################################################## Item = 4037 # ID валюты # Count = 2 # Каждый день гер.уможается на цену # Iname = "Coin of Luck" # Имя валюты # ############################################################## day = [] # Тут не трогаем # ############################################################ # Function to create Hero. For l2jcore. # Created by Hlorka. # ############################################################ # Функция присуждения статуса героя. # player - игрок # timeduration - количество дней геройствования def createHero(player,timeduration): if player == None: return if player.isHero(): player.sendMessage(u"\u041A\u0443\u0434\u0430 \u043D\u0430\u0445! \u0422\u044B \u0438 \u0442\u0430\u043A \u0433\u0435\ \u0440\u043E\u0439, \u043D\u0435 \u0431\u0430\u043B\u0443\u0439\u0441\u0438 \u0442\u0443\u0442 \u0443 \u0425\u043B\u043E\u0440\u043A\u0438!") return else: heroTime = timeduration * 24 * 60 * 60 * 1000; try: con = L2DatabaseFactory.getInstance().getConnection() upd = con.prepareStatement("REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator, hero_end_date) VALUES (?,?,?,?,?,?)") upd.setInt(1, player.getObjectId()) upd.setString(2, player.getName()) upd.setInt(3, 1) upd.setInt(4, 1) upd.setInt(5, int(player.isDonator())) upd.setLong(6, System.currentTimeMillis() + heroTime) upd.execute() DatabaseUtils.closeStatement(upd) con.close() except: player.sendMessage(u"[ERROR]: \u041F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u0432\u043D\u0443\u0442\u0440\u0435\u043D\ \u043D\u044F\u044F \u043E\u0448\u0438\u0431\u043A\u0430, \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u043A \u0430\u0434\ \u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0440\ \u0435\u0434\u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0439\u0442\u0435.") return player.sendMessage(u"\u0425\u043B\u043E\u0440\u043A\u0430 \u043F\u043E\u0437\u0434\u0440\u0430\u0432\u043B\u044F\ \u0435\u0442 \u0442\u0435\u0431\u044F! \u0422\u044B \u0442\u0435\u043F\u0435\u0440\u044C \u0433\u0435\u0440\u043E\u0439!") player.setIsHero(1) social = SocialAction(player.getObjectId(), 16) player.broadcastPacket(social) player.broadcastUserInfo() st = player.getQuestState(qn) st.playSound("skillsound7.sound_crystal_smelting") class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onAdvEvent(self,event,npc,player) : global day st = player.getQuestState(qn) htmltext = event xHRx = 0 eventSplit = event.split(" ") event = eventSplit[0] if event == "countHero" : try : xHRx = Integer.parseInt(eventSplit[1]) except : htmltext = "start.htm" return htmltext if (xHRx < 10): 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\u0438\u043d\u0438\u043c\u0443\u043c \u0445\u0438\u0440\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 10 \u0434\u043d\u0435\u0439 !</font>" htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>" htmltext += u"<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 day.append(xHRx) counts = int(xHRx*Count) st.playSound("ItemSound.quest_accept") 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>" htmltext += u"<table><tr><td align=center><font color=\"FF0000\">"+str(xHRx)+"</font> " htmltext += u"<font color=\"LEVEL\">\u0434\u043d\u0435\u0439 \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u0430,</td></tr>" htmltext += u"<tr><td align=center>C\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(counts)+"</font> <font color=\"LEVEL\">"+Iname+" !</font></td></tr></table>" 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\u0442\u044c \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e\" action=\"bypass -h Quest 50301_Hero setHero\" 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>" return htmltext if event == "setHero" : days = day[0] countss = int(days*Count) if st.getQuestItemsCount(Item) < countss : 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\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font>" htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>" htmltext += u"<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 elif not player.isNoble() : 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 \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e,<br>\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u0432\u043e\u0440\u044f\u043d\u0438\u043d\u043e\u043c !</font>" htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>" htmltext += u"<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 elif player.isHero(): 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 \u0438 \u0442\u0430\u043a \u0433\u0435\u0440\u043e\u0439 !</font>" htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>" htmltext += u"<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 st.takeItems(Item,countss) createHero(player,days) st.giveItems(6842,1) 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 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430</font> <font color=\"FF0000\">"+str(days)+"</font> " htmltext += u"<font color=\"LEVEL\">\u0434\u043d\u0435\u0439 !</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><br><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) day = [] return htmltext def onTalk(self,npc,player) : htmltext = "Sorry !" st = player.getQuestState(qn) if not st : st = self.newQuestState(player) htmltext = "start.htm" return htmltext QUEST = Quest(50301,qn,"custom") CREATED = State('Start', QUEST) STARTING = State('Starting', QUEST) STARTED = State('Started', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(NPC) QUEST.addTalkId(NPC)