HunTxD Posted October 10, 2012 Share Posted October 10, 2012 Have a script, but he dont save skills after restart. Who can help? p.s. Sorry my English, i from Ukraine=) import sys from com.l2jfrozen.gameserver.datatables import SkillTable from com.l2jfrozen.gameserver.model.quest import State from com.l2jfrozen.gameserver.model.quest import QuestState from com.l2jfrozen.gameserver.model import L2Augmentation from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest from com.l2jfrozen.util.random import Rnd from com.l2jfrozen.util.database import L2DatabaseFactory from com.l2jfrozen.gameserver.templates import L2EtcItemType from com.l2jfrozen.gameserver.templates import L2WeaponType from com.l2jfrozen.gameserver.templates import L2Item from com.l2jfrozen.gameserver.network.serverpackets import InventoryUpdate from java.lang import System # #@author KFan #ICQ: 604883692 #Skype: Kotyara20141 # NPC_ID = 60007 ITEM_ID = 57 #ITEM_COUNT = 0 #Do not need a subject ITEM_COUNT = 1 #A player can learn just one skill? 1 = true 0 = false ONLY_ONE = 0 qn = "9994_skill_trader" print "9994_skill_trader Loading Started" class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onTalk (self,npc,player): st = player.getQuestState(qn) ownerid = st.getPlayer().getObjectId() htmltext = "I have nothing to say you" npcId = npc.getNpcId() if not st : return cond = st.getInt("cond") onlyone = st.getInt("onlyone") if ONLY_ONE : if onlyone > 0 : return "fail.htm" if cond >= 0 : st.set("cond", "1") st.setState(STARTED) htmltext = "start.htm" return htmltext def onEvent (self,event,st) : htmltext = event cond = st.getInt("cond") ownerid = st.getPlayer().getObjectId() if event == "buy" : htmltext = "buy.htm" elif event.startswith('buy_') : if st.getQuestItemsCount(ITEM_ID) <= ITEM_COUNT : return "n-money.htm" buy_skill = str(event.replace("buy_", "")) buy_skill_splite = buy_skill.split('_') st.takeItems(ITEM_ID, ITEM_COUNT) st.getPlayer().addSkill(SkillTable.getInstance().getInfo(int(buy_skill_splite[0]), int(buy_skill_splite[1]))) skill_name = st.getPlayer().addSkill(SkillTable.getInstance().getInfo(int(buy_skill_splite[0]), int(buy_skill_splite[1])).getName()) con=L2DatabaseFactory.getInstance().getConnection() sql=con.prepareStatement("INSERT INTO character_skills (char_obj_id, skill_id, skill_level, skill_name) VALUES (?,?,?,?)") sql.setInt(1, ownerid) sql.setInt(2, int(buy_skill_splite[0])) sql.setInt(3, int(buy_skill_splite[1])) sql.setString(4, str(skill_name)) rs=sql.executeQuery() con.close() if ONLY_ONE : st.set("onlyone", "1") st.set("cond", "0") st.setState(COMPLETED) htmltext = "buy.htm" return htmltext QUEST = Quest( -1, qn, "custom") CREATED = State('Start', QUEST) STARTED = State('Started', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(NPC_ID) QUEST.addTalkId(NPC_ID) Quote Link to comment Share on other sites More sharing options...
Stone Posted October 10, 2012 Share Posted October 10, 2012 Are you kidding me right? Put a code tag and organise a bit ur topic [ code ][/ code ] Quote Link to comment Share on other sites More sharing options...
HunTxD Posted October 11, 2012 Author Share Posted October 11, 2012 Up Help please! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.