Jump to content
  • 0

[Help]Level NPC


AnsS

Question

13 answers to this question

Recommended Posts

  • 0

Create NPC  and use this script

 

st.getPlayer().getStat().addExpAndSp((st.getPlayer().getExp() - Experience.LEVEL[st.getPlayer().getStat().getLevel() + 84]),0)

Link to comment
Share on other sites

  • 0

Code:

 

/*

* This program is free software: you can redistribute it and/or modify it under

* the terms of the GNU General Public License as published by the Free Software

* Foundation, either version 3 of the License, or (at your option) any later

* version.

*

* This program is distributed in the hope that it will be useful, but WITHOUT

* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS

* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more

* details.

*

* You should have received a copy of the GNU General Public License along with

* this program. If not, see <http://www.gnu.org/licenses/>.

*/

package custom.LevelNPC;

 

import net.sf.l2j.gameserver.instancemanager.QuestManager;

import net.sf.l2j.gameserver.model.actor.L2Npc;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

import net.sf.l2j.gameserver.model.base.Experience;

import net.sf.l2j.gameserver.model.quest.Quest;

import net.sf.l2j.gameserver.model.quest.QuestState;

import net.sf.l2j.gameserver.network.clientpackets.Say2;

import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;

 

/**

* @author Based on idea of SeaNet

* @author lord_rex

* @since ToDay

*/

public class LevelNPC extends Quest

{

private final static int NPC = 50023;

 

public LevelNPC(int questId, String name, String descr)

{

super(questId, name, descr);

addFirstTalkId(NPC);

addStartNpc(NPC);

addTalkId(NPC);

}

 

public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)

{

String htmltext = "";

htmltext = npc.getNpcId() + ".htm";

QuestState st = player.getQuestState(getName());

 

if (event.equalsIgnoreCase("level_me"))

{

if (st.getPlayer().getLevel() < 1)

st.getPlayer().sendPacket(new CreatureSay(st.getPlayer().getObjectId(), Say2.TELL, "Level NPC", "wtf?"));

else if (st.getQuestItemsCount(57) < 1)

st.getPlayer().sendPacket(new CreatureSay(st.getPlayer().getObjectId(), Say2.TELL, "Level NPC", "You need 10.000.000 adena to add your level."));

else if (st.getPlayer().getKarma() > 0)

st.getPlayer().sendPacket(new CreatureSay(st.getPlayer().getObjectId(), Say2.TELL, "Level NPC", "You are chaotic, go away please!"));

else if (st.getPlayer().getPvpFlag() != 0)

st.getPlayer().sendPacket(new CreatureSay(st.getPlayer().getObjectId(), Say2.TELL, "Level NPC", "You cannot add your level when you are fighting."));

else if (st.getPlayer().isAttackingNow() == true)

st.getPlayer().sendPacket(new CreatureSay(st.getPlayer().getObjectId(), Say2.TELL, "Level NPC", "Leave me please!!!"));

else

{

st.getPlayer().setTarget(st.getPlayer());

 

st.takeItems(57, 1);

                                st.getPlayer().getStat().addExpAndSp((st.getPlayer().getExp() - Experience.LEVEL[st.getPlayer().getStat().getLevel() + 84]),0);

}

}

 

return htmltext;

}

 

public String onFirstTalk(L2Npc npc, L2PcInstance player)

{

String htmltext = "";

QuestState st = player.getQuestState(getName());

if (st == null)

{

Quest q = QuestManager.getInstance().getQuest(getName());

st = q.newQuestState(player);

}

htmltext = npc.getNpcId() + ".htm";

return htmltext;

}

 

public static void main(String[] args)

{

new LevelNPC(-1, "LevelNPC", "custom");

}

}

 

but not happend.

Link to comment
Share on other sites

  • 0

Try this:

 

import sys

from net.sf.l2j.gameserver.network.serverpackets import CreatureSay

from java.lang import System

from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance

from net.sf.l2j.gameserver.model.base import Experience

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 java.util import Iterator

from net.sf.l2j.gameserver.datatables import SkillTable

from net.sf.l2j import L2DatabaseFactory

from net.sf.l2j.gameserver.network.serverpackets import SetupGauge

 

qn = "7105_Delevel"

 

NPC=[7108]

MEDAL = 57

QuestId    = 7105

QuestName  = "Delevel"

QuestDesc  = "custom"

InitialHtml = "1.htm"

 

print "INFO Loaded: Delevel Manager by promo"

 

class Quest (JQuest) :

 

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

 

 

def onEvent(self,event,st):

htmltext = event

 

if  st.getPlayer().getLevel() < 1 :

st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban khong du level!"))

 

elif st.getQuestItemsCount(MEDAL) < 10000000 :

                      st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban khong co du adena !"))

 

elif st.getPlayer().getKarma() > 0 :

st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Diem karma cua ban qua cao!"))

 

elif st.getPlayer().getPvpFlag() != 0 :

st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban dang trong tinh trang chien dau!"))

 

elif st.getPlayer().isAttackingNow() == True :

st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Dont hit me, Plz!!!!"))

 

elif st.getPlayer().getLevel() < 1 :

SkillTable.getInstance().getInfo(1389,3).getEffects(st.getPlayer(),st.getPlayer())

st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 2, "Delevel Manager", "Ban  khong the su dung tiep tuc neu ban duoi cap 48"))

 

else:

st.getPlayer().setTarget(st.getPlayer())

 

if event == "2":

st.takeItems(MEDAL,10000000)

                                st.getPlayer().getStat().addExpAndSp((st.getPlayer().getExp() - Experience.LEVEL[st.getPlayer().getStat().getLevel() + 84]),0)

st.getPlayer().sendPacket(CreatureSay(st.getPlayer().getObjectId(), 3, "Delevel Manager", "Ban da duoc giam di 1 level"))

return "1.htm"

st.setState(State.COMPLETED)

st.exitQuest(1)

 

 

if htmltext != event:

st.setState(State.COMPLETED)

st.exitQuest(1)

return htmltext

 

def onTalk (self,npc,player):

  st = player.getQuestState(qn)

  htmltext = "<html><head><body> I dont have anything to say .</body></html>"

  st.setState(State.STARTED)

  return InitialHtml

 

QUEST      = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)

 

for npcId in NPC:

QUEST.addStartNpc(npcId)

QUEST.addTalkId(npcId)

 

Link to comment
Share on other sites

  • 0

Traceback (innermost last):

  (no code object) at line 0

SyntaxError: ('invalid syntax', ('__init__.py', 57, 33, '                                st.getPlayer().getStat().addExpAndSp((st.getPlayer().getExp() - Experience.LEVEL[st.getPlayer().getStat().getLevel() + 84]),0)'))

Link to comment
Share on other sites

  • 0

<html>

<head><title>Delevel Manager</title>

</head>

<body>

Click here to increase level.<br>

<center>

<table>

<tr>

<td align=center><button value="Increase  level " action="bypass -h Quest 7105_Delevel 2" width=264 height=24 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>

</tr>

</table>

</body></html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • for me the best designer on this forum we are very happy with @protoftw services!
    • DISCORD : utchiha_market telegram  https://t.me/utchiha_market SELLIX STORE : https://utchiha-market.mysellix.io/ Join our server for more products : https://discord.gg/hoodservices  
    • Hello friend does skillgrp have Encrypt? I'm trying to open it to use in another version I play and it's not working, good job  
    • Σας καλωσορίζουμε θερμά στο ολοκαίνουργιο κοινωνικό φόρουμ της Ελλάδος! Εγγραφείτε τώρα εντελώς ΔΩΡΕΆΝ στο Chatter.gr.   Τα πρώτα 50 μέλη που θα εγγραφούν θα λάβουν ΔΩΡΕΆΝ Premium αναβάθμιση! https://chatter.gr/ Κάντε Like και Follow τη σελίδα μας στο Facebook και προωθήστε την σε φίλους και συγγενείς σας! https://www.facebook.com/chatter.gr/ Επικοινωνήστε σε πραγματικό χρόνο και πραγματοποιήστε βιντεοκλήσεις ή φωνητικές κλήσεις με τα μέλη της κοινότητάς μας! Συνδεθείτε τώρα στον διακομιστή μας! https://discord.gg/BbCv6deT
    • The most authentic love spells are the most reliable source you can rely on. The most authentic of all these spells is cast in a variety of ways. Love can be mended or broken and so anyone can choose how you want to use the spells. You might want to bring back your ex-girlfriend or boyfriend or divorce her. There are A lot of differences in the world of love. First of all, we need to know that there is a special spiritual being around us. A real man that follows us up and finds what lucks in our life and hence finds a better solution to help us. Most of us are naïve and ignorant about this and hence less of us believe in all this. Contact me right now so that we begin the rituals right away. Authentic love spells (973) 384-3997! Get Back your Ex / lost lover Permanently! The most authentic love spells are spread the universal over e to those who apply to get them. They have helped mend broken hearts that have no hope all over. My most efficient and authentic love spells contain the most meditated magical powers. The powers take a bit of time to work. My physical powers are so strong that I have come through meditation and concentration to work for you. Most Powerful love spells (973) 384-3997! Get Back your Ex / lost lover Permanently. The authentic love spells have a package for married people and so they will also grant you the love you deserve and happiness in marriage. Many marriages are breaking and facing hardships, but you have failed to get ways to make it out. Contact me so that your marriage life is helped not to fall and restore the happiness that you once shared. My love spells are easily made through marriage portions and oils that you can easily perform on your own. Call: (973)384-3997
  • Topics

×
×
  • Create New...