Jump to content
  • 0

[Help]Level NPC


AnsS
 Share

Question

13 answers to this question

Recommended Posts

  • 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.

 Share



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disbaled AdBlock