Код
#------------------------------------------------------------------------------------------------------#
#Made by Z0mbie! (418260172) for www.la2base.ru. Have Fun!---------------------------------------------#
#------------------------------------------------------------------------------------------------------#
#---12.03.08 11.55 (GMT+5) NPC стало точить итемы правельно--------------------------------------------#
#---7.11.08 18.54 (GMT+5) Переписал код. добавил проверку на наличии проклятого оружия.----------------#
#---15.11.08 16.14 (GMT+5) Переписал полностью. теперь предметы именно _точатся_,а не так как раньше---#
#------------------------------------------------------------------------------------------------------#
#------Секция импортов,щас настроена на L2Jserver CT1.5,настройте под свою сборку----------------------#
import sys #
from com.l2jarchid.gameserver.model import Inventory #
from com.l2jarchid.gameserver.cache import HtmCache #
from com.l2jarchid.gameserver.model import L2ItemInstance #
from com.l2jarchid.gameserver.model.quest import State #
from com.l2jarchid.gameserver.model.quest import QuestState #
from com.l2jarchid.gameserver.network.serverpackets import InventoryUpdate #
from com.l2jarchid.gameserver.network.serverpackets import UserInfo #
from com.l2jarchid.gameserver.network.serverpackets import CharInfo #
from com.l2jarchid.gameserver.network.serverpackets import SystemMessage #
from com.l2jarchid.gameserver.model.quest.jython import QuestJython as JQuest #
#
#-----Секция настроек,настраивате как вам надо---------------------------------------------------------#
qn = "7778_Ench"
ADENA = 9999
PRISE = 100 #Цена
maxTalk = 0 # Сколько раз игрок может точнуть у НПЦ весчи.0 чтобы безконечно
ench = 1 # на скока точить
maxEnch =10000 # Максимальная заточка
lvl=20 # Минимальный уровень игрока,каторому можно пользоваться точилкой. 0 - для отключения
NPC = 56
#-----Главный код,ни чё не изминяйте,если не знаете что и куда--------------------------------------------
def Ench (st,item,player):
htmltext = HtmCache.getInstance().getHtm("data/scripts/custom/" + qn + "/enchanter.htm")
itemInstance = player.getInventory().getPaperdollItem(item)
curEnchant = itemInstance.getEnchantLevel()
encc=curEnchant+ench
if maxTalk==0:
htma=""
htmltext = htmltext.replace("htma",htma)
elif maxTalk>0:
id=st.getInt("cound")+1
st.set("cound",str(id))
htma="<br>Вы можете точиться:<font color=\"LEVEL\">"+str(maxTalk-id) +"</font>раз"
htmltext = htmltext.replace("htma",htma)
if encc>=maxEnch:
htmltext="<html>Вы больше не можети точиться</html>"
else:
st.takeItems(ADENA,PRISE)
player.getInventory().unEquipItemInSlotAndRecord(item)
itemInstance.setEnchantLevel(encc)
player.getInventory().equipItemAndRecord(itemInstance)
InventoryUpdate().addModifiedItem(itemInstance)
player.sendPacket(InventoryUpdate())
player.broadcastPacket(CharInfo(player))
player.sendPacket(UserInfo(player))
player.sendMessage("Enchanted"+itemInstance.getItem().getName()+" from "+str(curEnchant)+" to "+str(encc))
if st.getInt("cound")==maxTalk>0:
htmltext = "<html>Вы Больше не можете точиться</html>"
return htmltext
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onAdvEvent (self,event,npc,player) :
st = player.getQuestState(qn)
if event == "0" :
htmltext=Ench(st,Inventory.PAPERDOLL_UNDER,player)
if event == "1" :
htmltext=Ench(st,Inventory.PAPERDOLL_LEAR,player)
if event == "2" :
htmltext=Ench(st,Inventory.PAPERDOLL_REAR,player)
if event == "4" :
htmltext=Ench(st,Inventory.PAPERDOLL_NECK,player)
if event == "5" :
htmltext=Ench(st,Inventory.PAPERDOLL_RFINGER,player)
if event == "6" :
htmltext=Ench(st,Inventory.PAPERDOLL_LFINGER,player)
if event == "8" :
htmltext=Ench(st,Inventory.PAPERDOLL_HEAD,player)
if event == "9" :
htmltext=Ench(st,Inventory.PAPERDOLL_RHAND,player)
if event == "10" :
htmltext=Ench(st,Inventory.PAPERDOLL_LHAND,player)
if event == "11" :
htmltext=Ench(st,Inventory.PAPERDOLL_GLOVES,player)
if event == "12" :
htmltext=Ench(st,Inventory.PAPERDOLL_CHEST,player)
if event == "13" :
htmltext=Ench(st,Inventory.PAPERDOLL_LEGS,player)
if event == "14" :
htmltext=Ench(st,Inventory.PAPERDOLL_FEET,player)
return htmltext
def onTalk (self,npc,player) :
st = player.getQuestState(qn)
id = st.getInt("cound")
if not st : return htmltext
if npc.getNpcId() == NPC:
if player.getLevel()<lvl:
htmltext="<html>Достигнити вначале <font color=\"LEVEL\">"+str(lvl)+" уровня </font></html>"
st.exitQuest(1)
elif maxTalk==0:
htmltext = HtmCache.getInstance().getHtm("data/scripts/custom/"+qn+"/enchanter.htm")
htmltext = htmltext.replace("htma","")
elif player.isCursedWeaponEquipped():
htmltext = "<html>Я не точу игроков с проклятым оружеем!</html>"
st.exitQuest(1)
elif st.getQuestItemsCount(ADENA)<PRISE:
htmltext="<html> У вас нехватает денег<br> необходимо <font color=\"LEVEL\">"+str(PRISE)+"Аден</font></html>"
st.exitQuest(1)
elif id == maxTalk:
htmltext = "<html>Ты больше не можеш точитьcя</html>"
st.exitQuest(1)
elif maxTalk>=1:
htmltext = HtmCache.getInstance().getHtm("data/scripts/custom/"+qn+"/enchanter.htm")
htma="<br>Вы можете точиться:<font color=\"LEVEL\">"+str(maxTalk-id)+"</font>раз"
htmltext = htmltext.replace("htma",htma)
return htmltext
QUEST=Quest(7778, qn, "custom")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
print "-------------------------------> Enchanter loaded <-----------------------------"