Boby 40 Опубликовано 8 декабря, 2017 (изменено) Потскажите как сделать тут так что бы при набивании 1000 итемов больше не фармилось и после того как отдаёшь итемы квест закрывается # Created by t0rm3nt0r # Rate Fix by Gnat import sys from ru.catssoftware import Config from ru.catssoftware.gameserver.model.quest import State from ru.catssoftware.gameserver.model.quest import QuestState from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest qn = "690_newboss" DROP_CHANCE=100 RELICS = 7254 ENTRANCE = 7075 GHOST = 5 MOBS = [ 21396,21397,21398,21399,21400,21401,21402,21403,21404,21405,21406,21407,21408,21409,21410,21411,21412,21413,21414, \ 21415,21416,21417,21418,21419,21420,21421,21422,21423,21424,21425,21426,21427,21428,21429,21430,21431,21432,21433,21434,21798, \ 21799,21800,18120,18121,18122,18123,18124,18125,18126,18127,18128,18129,18130,18131,18132,18133,18134,18135,18136,18137,18138, \ 18139,18140,18141,18142,18143,18144,18145,18146,18147,18148,18149,18150,18151,18152,18153,18154,18155,18156,18157,18158,18159, \ 18160,18161,18162,18163,18164,18165,18166,18167,18168,18169,18170,18171,18172,18173,18174,18175,18176,18177,18178,18179,18180, \ 18181,18182,18183,18184,18185,18186,18187,18188,18189,18190,18191,18192,18193,18194,18195,18196,18197,18198,18199,18200,18201, \ 18202,18203,18204,18205,18206,18207,18208,18209,18210,18211,18212,18213,18214,18215,18216,18217,18218,18219,18220,18221,18222, \ 18223,18224,18225,18226,18227,18228,18229,18230,18231,18232,18233,18234,18235,18236,18237,18238,18239,18240,18241,18242,18243, \ 18244,18245,18246,18247,18248,18249,18250,18251,18252,18253,18254,18255,18256,13008,13009,13010,13011,13012,13013,13016,13017] REWARDS = [ 6881,6883,6885,6887,6891,6893,6895,6897,6899,7580 ] REWARDS2= [ 6882,6884,6886,6888,6892,6894,6896,6898,6900,7581 ] #Change this value to 1 if you wish 100% recipes, default 60% ALT_RP100=0 class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) self.questItemIds = [RELICS, ENTRANCE] def onEvent (self,event,st) : htmltext = event relics = st.getQuestItemsCount(RELICS) if event == "31538-03.htm" : if st.getPlayer().getLevel() >= 74 : st.set("cond","1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") else : htmltext = "31538-02.htm" st.exitQuest(1) elif event == "31538-07.htm" : if relics >= 1000 : htmltext = "31538-07.htm" st.takeItems(RELICS,1000) if ALT_RP100 == 1: st.giveItems(REWARDS2[st.getRandom(len(REWARDS2))],1) else: st.giveItems(REWARDS[st.getRandom(len(REWARDS))],1) else : htmltext = "31538-05.htm" elif event == "31538-08.htm" : st.exitQuest(1) return htmltext def onTalk (self,npc,player): htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>" st = player.getQuestState(qn) if st : id = st.getState() cond = st.getInt("cond") relics = st.getQuestItemsCount(RELICS) entrance = st.getQuestItemsCount(ENTRANCE) if id==State.CREATED: if player.getLevel() >= 74 : htmltext="31538-01.htm" else : htmltext="31538-02.htm" st.exitQuest(1) else : if cond == 1 and relics >= 1000 : htmltext = "31538-04.htm" elif entrance : htmltext = "31538-05.htm" else : htmltext = "31538-05a.htm" return htmltext def onKill(self,npc,player,isPet): partyMember = self.getRandomPartyMember(player, "1") if not partyMember: return st = partyMember.getQuestState(qn) if st : if st.getState() == State.STARTED : numItems, chance = divmod(DROP_CHANCE*Config.RATE_DROP_QUEST,100) if st.getRandom(100) < chance : numItems += 1 if numItems : st.giveItems(RELICS,10) st.playSound("ItemSound.quest_itemget") if st.getRandom(100) < 5 : st.giveItems(ENTRANCE,1) st.playSound("ItemSound.quest_middle") return QUEST = Quest(619, qn, "Relics of the Old Empire") QUEST.addStartNpc(GHOST) QUEST.addTalkId(GHOST) for mobId in MOBS : QUEST.addKillId(mobId) Изменено 8 декабря, 2017 пользователем Boby Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jRaxmir 3 Опубликовано 8 декабря, 2017 Можешь квестом поделиться? Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Falkland 51 Опубликовано 8 декабря, 2017 18 минут назад, Boby сказал: Потскажите как сделать тут так что бы при набивании 1000 итемов больше не фармилось и после того как отдаёшь итемы квест закрывается Показать контент # Created by t0rm3nt0r # Rate Fix by Gnat import sys from ru.catssoftware import Config from ru.catssoftware.gameserver.model.quest import State from ru.catssoftware.gameserver.model.quest import QuestState from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest qn = "690_newboss" DROP_CHANCE=100 RELICS = 7254 ENTRANCE = 7075 GHOST = 5 MOBS = [ 21396,21397,21398,21399,21400,21401,21402,21403,21404,21405,21406,21407,21408,21409,21410,21411,21412,21413,21414, \ 21415,21416,21417,21418,21419,21420,21421,21422,21423,21424,21425,21426,21427,21428,21429,21430,21431,21432,21433,21434,21798, \ 21799,21800,18120,18121,18122,18123,18124,18125,18126,18127,18128,18129,18130,18131,18132,18133,18134,18135,18136,18137,18138, \ 18139,18140,18141,18142,18143,18144,18145,18146,18147,18148,18149,18150,18151,18152,18153,18154,18155,18156,18157,18158,18159, \ 18160,18161,18162,18163,18164,18165,18166,18167,18168,18169,18170,18171,18172,18173,18174,18175,18176,18177,18178,18179,18180, \ 18181,18182,18183,18184,18185,18186,18187,18188,18189,18190,18191,18192,18193,18194,18195,18196,18197,18198,18199,18200,18201, \ 18202,18203,18204,18205,18206,18207,18208,18209,18210,18211,18212,18213,18214,18215,18216,18217,18218,18219,18220,18221,18222, \ 18223,18224,18225,18226,18227,18228,18229,18230,18231,18232,18233,18234,18235,18236,18237,18238,18239,18240,18241,18242,18243, \ 18244,18245,18246,18247,18248,18249,18250,18251,18252,18253,18254,18255,18256,13008,13009,13010,13011,13012,13013,13016,13017] REWARDS = [ 6881,6883,6885,6887,6891,6893,6895,6897,6899,7580 ] REWARDS2= [ 6882,6884,6886,6888,6892,6894,6896,6898,6900,7581 ] #Change this value to 1 if you wish 100% recipes, default 60% ALT_RP100=0 class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) self.questItemIds = [RELICS, ENTRANCE] def onEvent (self,event,st) : htmltext = event relics = st.getQuestItemsCount(RELICS) if event == "31538-03.htm" : if st.getPlayer().getLevel() >= 74 : st.set("cond","1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") else : htmltext = "31538-02.htm" st.exitQuest(1) elif event == "31538-07.htm" : if relics >= 1000 : htmltext = "31538-07.htm" st.takeItems(RELICS,1000) if ALT_RP100 == 1: st.giveItems(REWARDS2[st.getRandom(len(REWARDS2))],1) else: st.giveItems(REWARDS[st.getRandom(len(REWARDS))],1) else : htmltext = "31538-05.htm" elif event == "31538-08.htm" : st.exitQuest(1) return htmltext def onTalk (self,npc,player): htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>" st = player.getQuestState(qn) if st : id = st.getState() cond = st.getInt("cond") relics = st.getQuestItemsCount(RELICS) entrance = st.getQuestItemsCount(ENTRANCE) if id==State.CREATED: if player.getLevel() >= 74 : htmltext="31538-01.htm" else : htmltext="31538-02.htm" st.exitQuest(1) else : if cond == 1 and relics >= 1000 : htmltext = "31538-04.htm" elif entrance : htmltext = "31538-05.htm" else : htmltext = "31538-05a.htm" return htmltext def onKill(self,npc,player,isPet): partyMember = self.getRandomPartyMember(player, "1") if not partyMember: return st = partyMember.getQuestState(qn) if st : if st.getState() == State.STARTED : numItems, chance = divmod(DROP_CHANCE*Config.RATE_DROP_QUEST,100) if st.getRandom(100) < chance : numItems += 1 if numItems : st.giveItems(RELICS,10) st.playSound("ItemSound.quest_itemget") if st.getRandom(100) < 5 : st.giveItems(ENTRANCE,1) st.playSound("ItemSound.quest_middle") return QUEST = Quest(619, qn, "Relics of the Old Empire") QUEST.addStartNpc(GHOST) QUEST.addTalkId(GHOST) for mobId in MOBS : QUEST.addKillId(mobId) Неужели мало примеров? Каждый второй квест в l2 именно так работает. Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Boby 40 Опубликовано 8 декабря, 2017 Да я тупанул не подумал уже нашол тему //close Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты