Jump to content
  • 0

[Help]Level NPC


Question

13 answers to this question

Recommended Posts

  • 0
Posted

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.

  • 0
Posted

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)

 

  • 0
Posted

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)'))

  • 0
Posted

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

  • 0
Posted

I write, but not happened. It doesn't matter, but I say thank you for the much help because of that. You are neat, that you tried to help this much.

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.

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

    • Make it 20 no one’s going to buy your garbage files.
    • Maybe you have problem with card graphig on pc?
    • Dear friends, right now we are holding a grand competition with a prize fund of more than $ 1000 in our stores https://socnet.store , telegram store: https://socnet.shop and SMM panel: https://socnet.pro There are more than 50 prize places in our competition, each lucky person can take one of the places. Important condition: you must make a purchase at any time before June 1, 2025. The more purchases you make - the more chances you have to win the main prize in the community of $ 300! Our Online Shop: socnet.store Our SMM-Boosting Panel: socnet.pro Telegram Shop Bot: socnet.shop Telegram Support: https://t.me/solomon_bog Telegram Channel: https://t.me/accsforyou_shop Discord Support: @AllSocialNetworksShop Discord Server:https://discord.gg/y9AStFFsrh WhatsApp Support: 79051904467 WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n Email Support: solomonbog@socnet.store
    • Olá comunidade,   Apresento a vocês meu Painel UCP (User Control Panel) totalmente funcional e integrado ao servidor L2J, oferecendo uma experiência moderna, segura e extremamente prática para jogadores e administradores. Funcionalidades para Jogadores: Sistema de Doações Integrado com: [Stripe] [MercadoPago (Pix)] Ranking automático com os melhores PvP e PK do servidor. Troca de senha com validação segura. Serviços para jogadores, usando saldo: Alterar nome do personagem Outras funções customizáveis Loja de Itens: Compra de itens direto pelo painel Entrega automática no inventário in-game Atualização de saldo em segundos Interface multilíngue: Português e Inglês Funcionalidades para Administradores: Gerenciamento completo da Loja: Adicionar/editar/remover itens Visualização com ícones dinâmicos Gerenciamento de Saldos: Editar saldo das contas Verificar histórico de doações aprovadas e pendentes Gerenciamento de Contas Admin: Acesso diferenciado por nível (Admin ou GM) Controle seguro de permissões Painel de controle com informações em tempo real Imagens de Apresentação: Painel UCP - Página de Login Painel UCP - Página de Personagens Painel UCP - Página de Doação Painel UCP - Página de Shop Painel UCP - Página de Compra Painel UCP - Página de Serviços Painel UCP - Página de Ranking Painel UCP - Página de Trocar Senha Painel Admin UCP - Shop Painel Admin UCP - Gerenciar Shop Painel Admin UCP - Gerenciar Saldo Painel Admin UCP - Gerenciar Admin https://github.com/JulioPradoL2j/panel
  • Topics

×
×
  • 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 Disabled AdBlock