Hi Everyone, i'am posting here because i need help whit this code from npcbuffer, well i need to know what i need to change in the code to make the NPC cast the buffs, or what I need to edit for see an animation when i press the buff button??
import sys
from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from net.sf.l2j.gameserver.datatables import SkillTable
from net.sf.l2j import L2DatabaseFactory
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
qn = "9977_NPCBuffer"
NPC=[7106]
ADENA_ID=57
QuestId = 9977
QuestName = "NPCBuffer"
QuestDesc = "custom"
InitialHtml = "1.htm"
print "importing custom: 9977: NPCBuffer"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = event
count=st.getQuestItemsCount(ADENA_ID)
if count < 15000 or st.getPlayer().getLevel() < 2 :
htmltext = "<html><head><body>No Tienes Adena.<br></body></html>"
else:
st.takeItems(ADENA_ID,0)
st.getPlayer().setTarget(st.getPlayer())
if event == "1":
st.takeItems(ADENA_ID,1000)
st.getPlayer().useMagic(SkillTable.getInstance().getInfo(9951,5),False,False)
st.getPlayer().restoreHPMP()
return "1.htm"
st.setState(COMPLETED)
#Wind Walk
if event == "2":
st.takeItems(ADENA_ID,10000)
SkillTable.getInstance().getInfo(1204,2).getEffects(st.getPlayer(),st.getPlayer())
st.getPlayer().restoreHPMP()
return "2.htm"
st.setState(COMPLETED)
#Arcane Protection
if event == "3":
st.takeItems(ADENA_ID,10000)
SkillTable.getInstance().getInfo(1354,1).getEffects(st.getPlayer(),st.getPlayer())
st.getPlayer().restoreHPMP()
return "2.htm"
st.setState(COMPLETED)
#Shield
if event == "4":
st.takeItems(ADENA_ID,10000)
SkillTable.getInstance().getInfo(1040,3).getEffects(st.getPlayer(),st.getPlayer())
st.getPlayer().restoreHPMP()
return "2.htm"
st.setState(COMPLETED)
#Might
if event == "5":
st.takeItems(ADENA_ID,10000)
SkillTable.getInstance().getInfo(1068,3).getEffects(st.getPlayer(),st.getPlayer())
st.getPlayer().restoreHPMP()
return "2.htm"
st.setState(COMPLETED)
#Mental Shield
if event == "6":
st.takeItems(ADENA_ID,10000)
SkillTable.getInstance().getInfo(1035,4).getEffects(st.getPlayer(),st.getPlayer())
st.getPlayer().restoreHPMP()
return "2.htm"
st.setState(COMPLETED)
if htmltext != event:
st.setState(COMPLETED)
st.exitQuest(1)
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
htmltext = "<html><head><body>No Tengo Nada que decirte.</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)
with nothing more to say, thank you very much for the help ....
Francisko ^^*!
PD: i just post a part of the code, because the other repeats
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.
Hello.
This code works well. It removes buff with double click, but If you preffer remove buff with ALT + mouse click, place this code in AbnormalStatusWnd.uc
function OnLButtonDown(WindowHandle a_WindowHandle, int X, int Y)
{
local Rect windowBounds;
local int targetRow;
local int targetCol;
local StatusIconInfo info;
local SkillInfo skillInfo;
if (IsKeyDown(IK_alt) == false)
return;
// Find window position
windowBounds = Me.GetRect();
// Process clicks outside of window frame only
if (X > (windowBounds.nX + NSTATUSICON_FRAMESIZE))
{
// Calc row and col of targeted icon
targetRow = (Y - windowBounds.nY) / NSTATUSICON_SIZE;
targetCol = (X - windowBounds.nX - NSTATUSICON_FRAMESIZE) / NSTATUSICON_SIZE;
// Store status info of targeted icon
StatusIcon.GetItem(targetRow, targetCol, info);
// Store actual skill info and make sure it is exists
if (GetSkillInfo(info.ClassID, info.Level, skillInfo))
{
// Request server to stop skill effect
// Usage: _dispel:<int:skill_id>,<int :skill_level>
// Example: _dispel:313,8
RequestBypassToServer ( "_dispel:" $ string ( skillInfo. SkillID ) $ "," $ string ( skillInfo. SkillLevel ) ) ) ;
}
}
}
Question
Francisko
Hi Everyone, i'am posting here because i need help whit this code from npcbuffer, well i need to know what i need to change in the code to make the NPC cast the buffs, or what I need to edit for see an animation when i press the buff button??
with nothing more to say, thank you very much for the help ....
Francisko ^^*!
PD: i just post a part of the code, because the other repeats
4 answers to this question
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.