Доброго времени суток.
Поставил NPC-Аукцион на сборку l2jcore, но столкнулся с проблемой:
Выставляю какую-либо вещь на "Аукцион", но при покупке этой вещи она остается на Аукционе и появляется в инвентаре.
Так же можно забрать выставленную Вами вещь, но опять же проблема:
когда забираю вещь с аукциона она остается на продаже и появляется в инвентаре.
Если же вещь ++ и ее забрать с аукциона, она у вас появится +0, а на аукционе останется ++.
Пытался сам исправить, но безуспешно(NPC вообще перестало работать)
Очень прошу Вашей помощи.
Буду очень благодарен.
Вот сами скрипты:
Добавлено через 2 часа 11 минут
Ап! Ап! Ап! Ап! Ап! Ап!
Поставил NPC-Аукцион на сборку l2jcore, но столкнулся с проблемой:
Выставляю какую-либо вещь на "Аукцион", но при покупке этой вещи она остается на Аукционе и появляется в инвентаре.
Так же можно забрать выставленную Вами вещь, но опять же проблема:
когда забираю вещь с аукциона она остается на продаже и появляется в инвентаре.
Если же вещь ++ и ее забрать с аукциона, она у вас появится +0, а на аукционе останется ++.
Пытался сам исправить, но безуспешно(NPC вообще перестало работать)
Очень прошу Вашей помощи.
Буду очень благодарен.
Вот сами скрипты:
q8032_MarketBuy
import sys
from java.lang import System
from java.util import Iterator
from com.l2jcore.util.database import L2DatabaseFactory
from com.l2jcore.Game.network.serverpackets import CreatureSay
from com.l2jcore.Game.model.quest import State
from com.l2jcore.Game.model.quest import QuestState
from com.l2jcore.Game.model.quest.jython import QuestJython as JQuest
from com.l2jcore.Game.network.serverpackets import SystemMessage
from com.l2jcore.Game.model.actor.instance import L2ItemInstance
from com.l2jcore.Game.model import L2World
from com.l2jcore.Game.network.serverpackets import ConfirmDlg
from com.l2jcore.Game.network.serverpackets import UserInfo
from com.l2jcore.Game.network.serverpackets import CharInfo
from com.l2jcore.Game.network.serverpackets import InventoryUpdate
from com.l2jcore.Game.datatables.sql import ItemTable
from com.l2jcore.util.random import Rnd
qn = "q8032_MarketBuy"
MARKET = 80007
#type
weapons = "<button value=\"weapons\" action=\"bypass -h Quest q8032_MarketBuy show_wpns\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
armors = "<button value=\"armors\" action=\"bypass -h Quest q8032_MarketBuy show_arms\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
resources = "<button value=\"Ресы\" action=\"bypass -h Quest q8032_MarketBuy show_res\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
recipes = "<button value=\"Рецепты\" action=\"bypass -h Quest q8032_MarketBuy show_recp\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
books = "<button value=\"Книги\" action=\"bypass -h Quest q8032_MarketBuy show_buks\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
soulshots = "<button value=\"Соски\" action=\"bypass -h Quest q8032_MarketBuy show_shot\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
#grade
dgrade = "<button value=\D\ action=\"bypass -h Quest q8032_MarketBuy grade_1\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
cgrade = "<button value=\C\ action=\"bypass -h Quest q8032_MarketBuy grade_2\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
bgrade = "<button value=\B\ action=\"bypass -h Quest q8032_MarketBuy grade_3\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
agrade = "<button value=\A\ action=\"bypass -h Quest q8032_MarketBuy grade_4\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
sgrade = "<button value=\S\ action=\"bypass -h Quest q8032_MarketBuy grade_5\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
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 == "list" :
htmltext = "<html><body>Cписок товаров:<br>"
htmltext += "<table width=300><tr><td>"+weapons+"</td><td>"+armors+"</td><td>"+resources+"</td><td>"+recipes+"</td><td>"+books+"</td></tr>"
htmltext += "<tr><td></td><td></td><td></td><td></td><td>"+soulshots+"</td></tr></table>"
htmltext += "<table width=300><tr><td></td><td>Последние 50:</td></tr>"
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE mag.itemId>1 AND magicon.itemId=mag.itemId LIMIT 0,50")
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
pprice = price
if pprice >= 10000:
pprice = "<font color=00CCFF>"+str(pprice)+"</font>"
elif price >= 100000:
pprice = "<font color=FF0099>"+str(pprice)+"</font>"
elif price >= 1000000:
pprice = "<font color=FFCC00>"+str(pprice)+"</font>"
elif price >= 10000000:
pprice = "<font color=00FF66>"+str(pprice)+"</font>"
elif price >= 100000000:
pprice = "<font color=33CCCC>"+str(pprice)+"</font>"
elif price >= 1000000000:
pprice = "<font color=FF0066>"+str(pprice)+"</font>"
else:
pprice = "<font color=FFFFFF>"+str(pprice)+"</font>"
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a msg=\"Купить "+count+""+str(itemname)+" у "+str(nick)+" за "+str(price)+" adena?\" action=\"bypass -h Quest q8032_MarketBuy bye_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(pprice)+"; Продавец: "+str(nick)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("show_"):
wamrs = str(event.replace("show_", ""))
if wamrs == "wpns":
sortType = str("Weapon")
razdel = str("Оружие")
view = str("1")
elif wamrs == "arms":
sortType = str("Armor")
razdel = str("Броня")
view = str("2")
elif wamrs == "res":
sortType = str("Resource")
razdel = str("Ресурсы")
view = str("3")
elif wamrs == "recp":
sortType = str("Recipe")
razdel = str("Рецепты")
view = str("4")
elif wamrs == "buks":
sortType = str("Spellbook")
razdel = str("Книги")
view = str("5")
elif wamrs == "shot":
sortType = str("Soulshot")
razdel = str("Патроны")
view = str("6")
st.set("view",view)
htmltext = "<html><body><a action=\"bypass -h Quest q8032_MarketBuy list\">Cписок товаров</a>: "+razdel+"<br>"
con=L2DatabaseFactory.getInstance().getConnection()
if view == "1" or view == "2":
htmltext += "<table width=300><tr><td>"+dgrade+"</td><td>"+cgrade+"</td><td>"+bgrade+"</td><td>"+agrade+"</td><td>"+sgrade+"</td></tr></table>"
htmltext += "<table width=300><tr><td></td><td>Последние 50:</td></tr>"
sql=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE l2Type=? AND magicon.itemId=mag.itemId LIMIT 0,50")
else:
htmltext += "<table width=300><tr><td></td><td></td><td></td><td></td></tr>"
sql=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE l2Type=? AND magicon.itemId=mag.itemId")
htmltext += "<tr><td></td><td>Предмет</td></tr>"
listitems=sql
listitems.setString(1, sortType)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("l2Type")
ltype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
if price >= 10000:
price = "<font color=00CCFF>"+str(price)+"</font>"
elif price >= 100000:
price = "<font color=FF0099>"+str(price)+"</font>"
elif price >= 1000000:
price = "<font color=FFCC00>"+str(price)+"</font>"
elif price >= 10000000:
price = "<font color=00FF66>"+str(price)+"</font>"
elif price >= 100000000:
price = "<font color=33CCCC>"+str(price)+"</font>"
elif price >= 1000000000:
price = "<font color=FF0066>"+str(price)+"</font>"
else:
price = "<font color=FFFFFF>"+str(price)+"</font>"
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8032_MarketBuy bye_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(price)+"; Продавец: "+str(nick)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("grade_"):
grade = int(event.replace("grade_", ""))
wamrs= st.getInt("view")
if wamrs == 1:
sortType = str("Weapon")
razdel = str("Оружие")
link = str("show_wpns")
elif wamrs == 2:
sortType = str("Armor")
razdel = str("Броня")
link = str("show_arms")
elif wamrs == 3:
sortType = str("Resource")
razdel = str("Ресурсы")
link = str("show_res")
elif wamrs == 4:
sortType = str("Recipe")
razdel = str("Рецепты")
link = str("show_recp")
elif wamrs == 5:
sortType = str("Spellbook")
razdel = str("Книги")
link = str("show_buks")
elif wamrs == 6:
sortType = str("Soulshot")
razdel = str("Патроны")
link = str("show_shot")
if grade == 1:
pgrade = str("[D]")
elif grade == 2:
pgrade = str("[C]")
elif grade == 3:
pgrade = str("[B]")
elif grade == 4:
pgrade = str("[A]")
elif grade == 5:
pgrade = str("[S]")
htmltext = "<html><body><a action=\"bypass -h Quest q8032_MarketBuy list\">Cписок товаров</a>: <a action=\"bypass -h Quest q8032_MarketBuy "+link+"\">"+razdel+"</a>: "+pgrade+" <br>"
htmltext += "<table width=300><tr><td>"+dgrade+"</td><td>"+cgrade+"</td><td>"+bgrade+"</td><td>"+agrade+"</td><td>"+sgrade+"</td></tr></table>"
htmltext += "<table width=300><tr><td></td><td>Предмет</td></tr>"
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE l2Type=? AND itemGrade=? AND magicon.itemId=mag.itemId")
listitems.setString(1, sortType)
listitems.setInt(2, grade)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
if price >= 10000:
price = "<font color=00CCFF>"+str(price)+"</font>"
elif price >= 100000:
price = "<font color=FF0099>"+str(price)+"</font>"
elif price >= 1000000:
price = "<font color=FFCC00>"+str(price)+"</font>"
elif price >= 10000000:
price = "<font color=00FF66>"+str(price)+"</font>"
elif price >= 100000000:
price = "<font color=33CCCC>"+str(price)+"</font>"
elif price >= 1000000000:
price = "<font color=FF0066>"+str(price)+"</font>"
else:
price = "<font color=FFFFFF>"+str(price)+"</font>"
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8032_MarketBuy bye_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(price)+"; Продавец: "+str(nick)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("bye_"):
itemObjId = int(event.replace("bye_", ""))
#=====#
conn=L2DatabaseFactory.getInstance().getConnection()
byeitem=conn.prepareStatement("SELECT ownerId,char_name,ItemName,enchLvl,itemGrade,l2Type,itemType,itemId,itemObjId,count,prise FROM z_market_sell WHERE itemObjId=?")
byeitem.setInt(1, itemObjId)
rs=byeitem.executeQuery()
while (rs.next()) :
owner=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
try :
if st.getQuestItemsCount(4037) >= price:
st.takeItems(4037,price)
if ench == 0:
st.giveItems(item,count)
enchant = str("")
else:
st.giveItems(item,count,ench)
enchant = " +"+str(ench)+""
st.getPlayer().sendPacket(SystemMessage.sendString("Куплено "+str(count)+" "+(itemname)+" у "+str(nick)+" за "+str(price)+" adena!"));
htmltext = "<html><body>Куплено <font color=LEVEL>"+str(count)+" "+(itemname)+"</font> у "+str(nick)+" за "+str(price)+" adena!<br></body></html>"
#
pvin = ""+str(count)+" "+str(itemname)+""
player.sendPacket(ConfirmDlg(614,"Предмет "+str(count)+" "+(itemname)+" был продан на аукционе!"))
seller = L2World.getInstance().getPlayer(nick)
if seller:
seller.sendPacket(SystemMessage.sendString("Предмет "+str(count)+" "+(itemname)+" был продан на аукционе!"));
private=L2DatabaseFactory.getInstance().getConnection()
off=private.prepareStatement("INSERT INTO z_market_private (ownerId,ItemName,itemObjId,prise) VALUES (?,?,?,?)")
off.setInt(1, owner)
off.setString(2, pvin)
off.setInt(3, itemObjId)
off.setInt(4, price)
try :
off.executeUpdate()
off.close()
private.close()
except :
try : private.close()
except : pass
#
con=L2DatabaseFactory.getInstance().getConnection()
kupleno=con.prepareStatement("DELETE FROM z_market_sell WHERE itemObjId = ?")
kupleno.setInt(1, itemObjId)
try :
kupleno.executeUpdate()
kupleno.close()
con.close()
except :
try : con.close()
except : pass
else:
htmltext = "<html><body>У вас не хватает денег</body></html>"
except :
try : insertion.close()
except : pass
try :
conn.close()
except :
pass
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
npcId = npc.getNpcId()
if npcId == MARKET:
htmltext = "privetstvie.htm"
return htmltext
QUEST = Quest(8032,qn,"custom")
CREATED = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(MARKET)
QUEST.addTalkId(MARKET)
from java.lang import System
from java.util import Iterator
from com.l2jcore.util.database import L2DatabaseFactory
from com.l2jcore.Game.network.serverpackets import CreatureSay
from com.l2jcore.Game.model.quest import State
from com.l2jcore.Game.model.quest import QuestState
from com.l2jcore.Game.model.quest.jython import QuestJython as JQuest
from com.l2jcore.Game.network.serverpackets import SystemMessage
from com.l2jcore.Game.model.actor.instance import L2ItemInstance
from com.l2jcore.Game.model import L2World
from com.l2jcore.Game.network.serverpackets import ConfirmDlg
from com.l2jcore.Game.network.serverpackets import UserInfo
from com.l2jcore.Game.network.serverpackets import CharInfo
from com.l2jcore.Game.network.serverpackets import InventoryUpdate
from com.l2jcore.Game.datatables.sql import ItemTable
from com.l2jcore.util.random import Rnd
qn = "q8032_MarketBuy"
MARKET = 80007
#type
weapons = "<button value=\"weapons\" action=\"bypass -h Quest q8032_MarketBuy show_wpns\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
armors = "<button value=\"armors\" action=\"bypass -h Quest q8032_MarketBuy show_arms\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
resources = "<button value=\"Ресы\" action=\"bypass -h Quest q8032_MarketBuy show_res\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
recipes = "<button value=\"Рецепты\" action=\"bypass -h Quest q8032_MarketBuy show_recp\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
books = "<button value=\"Книги\" action=\"bypass -h Quest q8032_MarketBuy show_buks\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
soulshots = "<button value=\"Соски\" action=\"bypass -h Quest q8032_MarketBuy show_shot\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
#grade
dgrade = "<button value=\D\ action=\"bypass -h Quest q8032_MarketBuy grade_1\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
cgrade = "<button value=\C\ action=\"bypass -h Quest q8032_MarketBuy grade_2\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
bgrade = "<button value=\B\ action=\"bypass -h Quest q8032_MarketBuy grade_3\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
agrade = "<button value=\A\ action=\"bypass -h Quest q8032_MarketBuy grade_4\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
sgrade = "<button value=\S\ action=\"bypass -h Quest q8032_MarketBuy grade_5\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"
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 == "list" :
htmltext = "<html><body>Cписок товаров:<br>"
htmltext += "<table width=300><tr><td>"+weapons+"</td><td>"+armors+"</td><td>"+resources+"</td><td>"+recipes+"</td><td>"+books+"</td></tr>"
htmltext += "<tr><td></td><td></td><td></td><td></td><td>"+soulshots+"</td></tr></table>"
htmltext += "<table width=300><tr><td></td><td>Последние 50:</td></tr>"
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE mag.itemId>1 AND magicon.itemId=mag.itemId LIMIT 0,50")
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
pprice = price
if pprice >= 10000:
pprice = "<font color=00CCFF>"+str(pprice)+"</font>"
elif price >= 100000:
pprice = "<font color=FF0099>"+str(pprice)+"</font>"
elif price >= 1000000:
pprice = "<font color=FFCC00>"+str(pprice)+"</font>"
elif price >= 10000000:
pprice = "<font color=00FF66>"+str(pprice)+"</font>"
elif price >= 100000000:
pprice = "<font color=33CCCC>"+str(pprice)+"</font>"
elif price >= 1000000000:
pprice = "<font color=FF0066>"+str(pprice)+"</font>"
else:
pprice = "<font color=FFFFFF>"+str(pprice)+"</font>"
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a msg=\"Купить "+count+""+str(itemname)+" у "+str(nick)+" за "+str(price)+" adena?\" action=\"bypass -h Quest q8032_MarketBuy bye_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(pprice)+"; Продавец: "+str(nick)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("show_"):
wamrs = str(event.replace("show_", ""))
if wamrs == "wpns":
sortType = str("Weapon")
razdel = str("Оружие")
view = str("1")
elif wamrs == "arms":
sortType = str("Armor")
razdel = str("Броня")
view = str("2")
elif wamrs == "res":
sortType = str("Resource")
razdel = str("Ресурсы")
view = str("3")
elif wamrs == "recp":
sortType = str("Recipe")
razdel = str("Рецепты")
view = str("4")
elif wamrs == "buks":
sortType = str("Spellbook")
razdel = str("Книги")
view = str("5")
elif wamrs == "shot":
sortType = str("Soulshot")
razdel = str("Патроны")
view = str("6")
st.set("view",view)
htmltext = "<html><body><a action=\"bypass -h Quest q8032_MarketBuy list\">Cписок товаров</a>: "+razdel+"<br>"
con=L2DatabaseFactory.getInstance().getConnection()
if view == "1" or view == "2":
htmltext += "<table width=300><tr><td>"+dgrade+"</td><td>"+cgrade+"</td><td>"+bgrade+"</td><td>"+agrade+"</td><td>"+sgrade+"</td></tr></table>"
htmltext += "<table width=300><tr><td></td><td>Последние 50:</td></tr>"
sql=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE l2Type=? AND magicon.itemId=mag.itemId LIMIT 0,50")
else:
htmltext += "<table width=300><tr><td></td><td></td><td></td><td></td></tr>"
sql=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE l2Type=? AND magicon.itemId=mag.itemId")
htmltext += "<tr><td></td><td>Предмет</td></tr>"
listitems=sql
listitems.setString(1, sortType)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("l2Type")
ltype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
if price >= 10000:
price = "<font color=00CCFF>"+str(price)+"</font>"
elif price >= 100000:
price = "<font color=FF0099>"+str(price)+"</font>"
elif price >= 1000000:
price = "<font color=FFCC00>"+str(price)+"</font>"
elif price >= 10000000:
price = "<font color=00FF66>"+str(price)+"</font>"
elif price >= 100000000:
price = "<font color=33CCCC>"+str(price)+"</font>"
elif price >= 1000000000:
price = "<font color=FF0066>"+str(price)+"</font>"
else:
price = "<font color=FFFFFF>"+str(price)+"</font>"
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8032_MarketBuy bye_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(price)+"; Продавец: "+str(nick)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("grade_"):
grade = int(event.replace("grade_", ""))
wamrs= st.getInt("view")
if wamrs == 1:
sortType = str("Weapon")
razdel = str("Оружие")
link = str("show_wpns")
elif wamrs == 2:
sortType = str("Armor")
razdel = str("Броня")
link = str("show_arms")
elif wamrs == 3:
sortType = str("Resource")
razdel = str("Ресурсы")
link = str("show_res")
elif wamrs == 4:
sortType = str("Recipe")
razdel = str("Рецепты")
link = str("show_recp")
elif wamrs == 5:
sortType = str("Spellbook")
razdel = str("Книги")
link = str("show_buks")
elif wamrs == 6:
sortType = str("Soulshot")
razdel = str("Патроны")
link = str("show_shot")
if grade == 1:
pgrade = str("[D]")
elif grade == 2:
pgrade = str("[C]")
elif grade == 3:
pgrade = str("[B]")
elif grade == 4:
pgrade = str("[A]")
elif grade == 5:
pgrade = str("[S]")
htmltext = "<html><body><a action=\"bypass -h Quest q8032_MarketBuy list\">Cписок товаров</a>: <a action=\"bypass -h Quest q8032_MarketBuy "+link+"\">"+razdel+"</a>: "+pgrade+" <br>"
htmltext += "<table width=300><tr><td>"+dgrade+"</td><td>"+cgrade+"</td><td>"+bgrade+"</td><td>"+agrade+"</td><td>"+sgrade+"</td></tr></table>"
htmltext += "<table width=300><tr><td></td><td>Предмет</td></tr>"
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE l2Type=? AND itemGrade=? AND magicon.itemId=mag.itemId")
listitems.setString(1, sortType)
listitems.setInt(2, grade)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
if price >= 10000:
price = "<font color=00CCFF>"+str(price)+"</font>"
elif price >= 100000:
price = "<font color=FF0099>"+str(price)+"</font>"
elif price >= 1000000:
price = "<font color=FFCC00>"+str(price)+"</font>"
elif price >= 10000000:
price = "<font color=00FF66>"+str(price)+"</font>"
elif price >= 100000000:
price = "<font color=33CCCC>"+str(price)+"</font>"
elif price >= 1000000000:
price = "<font color=FF0066>"+str(price)+"</font>"
else:
price = "<font color=FFFFFF>"+str(price)+"</font>"
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8032_MarketBuy bye_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(price)+"; Продавец: "+str(nick)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("bye_"):
itemObjId = int(event.replace("bye_", ""))
#=====#
conn=L2DatabaseFactory.getInstance().getConnection()
byeitem=conn.prepareStatement("SELECT ownerId,char_name,ItemName,enchLvl,itemGrade,l2Type,itemType,itemId,itemObjId,count,prise FROM z_market_sell WHERE itemObjId=?")
byeitem.setInt(1, itemObjId)
rs=byeitem.executeQuery()
while (rs.next()) :
owner=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
try :
if st.getQuestItemsCount(4037) >= price:
st.takeItems(4037,price)
if ench == 0:
st.giveItems(item,count)
enchant = str("")
else:
st.giveItems(item,count,ench)
enchant = " +"+str(ench)+""
st.getPlayer().sendPacket(SystemMessage.sendString("Куплено "+str(count)+" "+(itemname)+" у "+str(nick)+" за "+str(price)+" adena!"));
htmltext = "<html><body>Куплено <font color=LEVEL>"+str(count)+" "+(itemname)+"</font> у "+str(nick)+" за "+str(price)+" adena!<br></body></html>"
#
pvin = ""+str(count)+" "+str(itemname)+""
player.sendPacket(ConfirmDlg(614,"Предмет "+str(count)+" "+(itemname)+" был продан на аукционе!"))
seller = L2World.getInstance().getPlayer(nick)
if seller:
seller.sendPacket(SystemMessage.sendString("Предмет "+str(count)+" "+(itemname)+" был продан на аукционе!"));
private=L2DatabaseFactory.getInstance().getConnection()
off=private.prepareStatement("INSERT INTO z_market_private (ownerId,ItemName,itemObjId,prise) VALUES (?,?,?,?)")
off.setInt(1, owner)
off.setString(2, pvin)
off.setInt(3, itemObjId)
off.setInt(4, price)
try :
off.executeUpdate()
off.close()
private.close()
except :
try : private.close()
except : pass
#
con=L2DatabaseFactory.getInstance().getConnection()
kupleno=con.prepareStatement("DELETE FROM z_market_sell WHERE itemObjId = ?")
kupleno.setInt(1, itemObjId)
try :
kupleno.executeUpdate()
kupleno.close()
con.close()
except :
try : con.close()
except : pass
else:
htmltext = "<html><body>У вас не хватает денег</body></html>"
except :
try : insertion.close()
except : pass
try :
conn.close()
except :
pass
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
npcId = npc.getNpcId()
if npcId == MARKET:
htmltext = "privetstvie.htm"
return htmltext
QUEST = Quest(8032,qn,"custom")
CREATED = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(MARKET)
QUEST.addTalkId(MARKET)
q8033_MarketSell
import sys
from java.lang import System
from java.util import Iterator
from com.l2jcore.util.database import L2DatabaseFactory
from com.l2jcore.Game.network.serverpackets import SystemMessage
from com.l2jcore.Game.model.quest import State
from com.l2jcore.Game.model.quest import QuestState
from com.l2jcore.Game.model.quest.jython import QuestJython as JQuest
from com.l2jcore.Game.templates import L2EtcItemType
from com.l2jcore.Game.templates import L2Item
from com.l2jcore.util.random import Rnd
qn = "q8033_MarketSell"
MARKET = 80007
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 == "spisok":
htmltext = ""
for Item in st.getPlayer().getInventory().getItems():
itemTemplate = Item.getItem()
if itemTemplate.getDuration() == -1 and not Item.isEquipped() and not Item.isAugmented() and not Item.isConsumable() and Item.getItemType() != L2EtcItemType.OTHER and Item.getItemType() != L2EtcItemType.SCROLL and Item.getItemType() != L2EtcItemType.PET_COLLAR and Item.isTradeable() and Item.getItemId() != 4037 or Item.getItemType() == L2EtcItemType.SHOT:# and Item.getEnchantLevel() == 0:
count = Item.getCount()
grade = itemTemplate.getCrystalType()
idtest = Item.getItemId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
listitems.setInt(1, idtest)
rs=listitems.executeQuery()
while (rs.next()) :
icon=rs.getString("itemIcon")
try :
if grade == 1:
pgrade = str("[D]")
elif grade == 2:
pgrade = str("[C]")
elif grade == 3:
pgrade = str("[B]")
elif grade == 4:
pgrade = str("[A]")
elif grade == 5:
pgrade = str("[S]")
else:
pgrade = str("")
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8033_MarketSell sell_" + str(Item.getObjectId()) +"\">"+str(count)+" " + itemTemplate.getName() + ""+str(pgrade)+" " + enchant + "</a></td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
#if htmltext == "":
#htmltext = "Вам нечего продать."
htmltext = "<html><body>Market:<br>Вещи на продажу:<br><table width=300>" + htmltext + "</table></body></html>"
elif event.startswith("sell_"):
itemObjId = int(event.replace("sell_", ""))
obj = str(itemObjId)
Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
itemTemplate = Item.getItem()
if Item and itemTemplate.getDuration() == -1 and not Item.isEquipped() and not Item.isAugmented() and not Item.isConsumable() and Item.getItemType() != L2EtcItemType.OTHER and Item.getItemType() != L2EtcItemType.SCROLL and Item.getItemType() != L2EtcItemType.PET_COLLAR and Item.isTradeable() and Item.getItemId() != 403 or Item.getItemType() == L2EtcItemType.SHOT:# and Item.getEnchantLevel() == 0:
cnt = Item.getCount()
count = str(cnt)
grade = itemTemplate.getCrystalType()
igrade = str(itemTemplate.getCrystalType())
itype = str(Item.getItemType())
idtest = Item.getItemId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
listitems.setInt(1, idtest)
rs=listitems.executeQuery()
while (rs.next()) :
icon=rs.getString("itemIcon")
try :
if grade == 1:
pgrade = str("[D]")
elif grade == 2:
pgrade = str("[C]")
elif grade == 3:
pgrade = str("[B]")
elif grade == 4:
pgrade = str("[A]")
elif grade == 5:
pgrade = str("[S]")
else:
pgrade = str("")
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
st.set("sellitem",obj)
st.set("count",count)
st.set("grade",igrade)
st.set("type",itype)
htmltext = "<html><body>Market:<br>Вещь на продажу:<br>"
htmltext += "<img src=\"Icon."+str(icon)+"\" width=32 height=32>"
htmltext += "<font color=LEVEL>" + itemTemplate.getName() + ""+pgrade+" " + enchant + "</font><br><br>"
htmltext += "Количество: "+count+"<br>"
htmltext += "Установите цену: <br>"
htmltext += "<edit var=\"price\" width=250><br><button value=\"Ok\" action=\"bypass -h Quest q8033_MarketSell $price\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
htmltext += "<br>*установите цену за 1 предмет, конечная цена = кол-во*цену.</body></html>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
#else :
#htmltext = "<html><body>Market:<br>Oops!</body></html>"
elif event >= 0 or event <=2144000000:
itemPrice = int(event)
itemObjId = st.getInt("sellitem")
itemCount = st.getInt("count")
itemGrade = st.getInt("grade")
itemPrice = int(itemPrice*itemCount)
Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
itemTemplate = Item.getItem()
idtest = Item.getItemId()
itype = str(Item.getItemType())
itemType = str(Item.getItemType())
if Item and not Item.isEquipped() :
count = str(itemCount)
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
#weapons
if itype == "Sword":
ptype = str ("Weapon")
elif itype == "Blunt":
ptype = str ("Weapon")
elif itype == "Dagger":
ptype = str ("Weapon")
elif itype == "Bow":
ptype = str ("Weapon")
elif itype == "Etc":
ptype = str ("Weapon")
elif itype == "Pole":
ptype = str ("Weapon")
elif itype == "Fist":
ptype = str ("Weapon")
elif itype == "Dual Sword":
ptype = str ("Weapon")
elif itype == "Dual Fist":
ptype = str ("Weapon")
elif itype == "Big Sword":
ptype = str ("Weapon")
elif itype == "Big Blunt":
ptype = str ("Weapon")
#armor
elif itype == "Shield":
ptype = str ("Armor")
elif itype == "Light":
ptype = str ("Armor")
elif itype == "Heavy":
ptype = str ("Armor")
elif itype == "Magic":
ptype = str ("Armor")
elif itype == "None":
ptype = str ("Armor")
#recipes
elif itype == "Receipe":
ptype = str ("Recipe")
#resources
elif itype == "Material":
ptype = str ("Resource")
#spellbook
elif itype == "Spellbook":
ptype = str ("Spellbook")
#soulshot
elif itype == "Shot":
ptype = str ("Soulshot")
st.getPlayer().destroyItem("q8033_MarketSell",itemObjId, itemCount, st.getPlayer(), 0)
st.getPlayer().sendPacket(SystemMessage.sendString(""+count+ " " + itemTemplate.getName() + "" + enchant + " выстановлено на аукцион за "+str(itemPrice)+" adena"));
htmltext = "<html><body>Market:<br>Выстановлено на аукцион:<br><font color=LEVEL>"+count+" " + itemTemplate.getName() + "" + enchant + "</font> за "+str(itemPrice)+" adena"
#=====#
itemname = "" + itemTemplate.getName() + "" + enchant + ""
enchLvl=Item.getEnchantLevel()
ownerid = st.getPlayer().getObjectId()
name = st.getPlayer().getName()
con=L2DatabaseFactory.getInstance().getConnection()
insertion=con.prepareStatement("INSERT INTO z_market_sell (ownerId,char_name,ItemName,enchLvl,itemGrade,l2Type,itemType,itemId,itemObjId,count,prise) VALUES (?,?,?,?,?,?,?,?,?,?,?)")
insertion.setInt(1, ownerid)
insertion.setString(2, name)
insertion.setString(3, itemname)
insertion.setInt(4, enchLvl)
insertion.setInt(5, itemGrade)
insertion.setString(6, ptype)
insertion.setString(7, itemType)
insertion.setInt(8, idtest)
insertion.setInt(9, itemObjId)
insertion.setInt(10, itemCount)
insertion.setInt(11, itemPrice)
try :
insertion.executeUpdate()
insertion.close()
con.close()
except :
try : con.close()
except : pass
else :
htmltext = "<html><body>Market:<br>Oops!</body></html>"
else:
htmltext = "<html><body>Market:<br>Oops!</body></html>"
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
npcId = npc.getNpcId()
if npcId == MARKET:
htmltext = "privetstvie.htm"
return htmltext
QUEST = Quest(8033,qn,"custom")
CREATED = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(MARKET)
QUEST.addTalkId(MARKET)
from java.lang import System
from java.util import Iterator
from com.l2jcore.util.database import L2DatabaseFactory
from com.l2jcore.Game.network.serverpackets import SystemMessage
from com.l2jcore.Game.model.quest import State
from com.l2jcore.Game.model.quest import QuestState
from com.l2jcore.Game.model.quest.jython import QuestJython as JQuest
from com.l2jcore.Game.templates import L2EtcItemType
from com.l2jcore.Game.templates import L2Item
from com.l2jcore.util.random import Rnd
qn = "q8033_MarketSell"
MARKET = 80007
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 == "spisok":
htmltext = ""
for Item in st.getPlayer().getInventory().getItems():
itemTemplate = Item.getItem()
if itemTemplate.getDuration() == -1 and not Item.isEquipped() and not Item.isAugmented() and not Item.isConsumable() and Item.getItemType() != L2EtcItemType.OTHER and Item.getItemType() != L2EtcItemType.SCROLL and Item.getItemType() != L2EtcItemType.PET_COLLAR and Item.isTradeable() and Item.getItemId() != 4037 or Item.getItemType() == L2EtcItemType.SHOT:# and Item.getEnchantLevel() == 0:
count = Item.getCount()
grade = itemTemplate.getCrystalType()
idtest = Item.getItemId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
listitems.setInt(1, idtest)
rs=listitems.executeQuery()
while (rs.next()) :
icon=rs.getString("itemIcon")
try :
if grade == 1:
pgrade = str("[D]")
elif grade == 2:
pgrade = str("[C]")
elif grade == 3:
pgrade = str("[B]")
elif grade == 4:
pgrade = str("[A]")
elif grade == 5:
pgrade = str("[S]")
else:
pgrade = str("")
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
if count > 1:
count = str(count)
else:
count = str("")
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8033_MarketSell sell_" + str(Item.getObjectId()) +"\">"+str(count)+" " + itemTemplate.getName() + ""+str(pgrade)+" " + enchant + "</a></td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
#if htmltext == "":
#htmltext = "Вам нечего продать."
htmltext = "<html><body>Market:<br>Вещи на продажу:<br><table width=300>" + htmltext + "</table></body></html>"
elif event.startswith("sell_"):
itemObjId = int(event.replace("sell_", ""))
obj = str(itemObjId)
Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
itemTemplate = Item.getItem()
if Item and itemTemplate.getDuration() == -1 and not Item.isEquipped() and not Item.isAugmented() and not Item.isConsumable() and Item.getItemType() != L2EtcItemType.OTHER and Item.getItemType() != L2EtcItemType.SCROLL and Item.getItemType() != L2EtcItemType.PET_COLLAR and Item.isTradeable() and Item.getItemId() != 403 or Item.getItemType() == L2EtcItemType.SHOT:# and Item.getEnchantLevel() == 0:
cnt = Item.getCount()
count = str(cnt)
grade = itemTemplate.getCrystalType()
igrade = str(itemTemplate.getCrystalType())
itype = str(Item.getItemType())
idtest = Item.getItemId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
listitems.setInt(1, idtest)
rs=listitems.executeQuery()
while (rs.next()) :
icon=rs.getString("itemIcon")
try :
if grade == 1:
pgrade = str("[D]")
elif grade == 2:
pgrade = str("[C]")
elif grade == 3:
pgrade = str("[B]")
elif grade == 4:
pgrade = str("[A]")
elif grade == 5:
pgrade = str("[S]")
else:
pgrade = str("")
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
st.set("sellitem",obj)
st.set("count",count)
st.set("grade",igrade)
st.set("type",itype)
htmltext = "<html><body>Market:<br>Вещь на продажу:<br>"
htmltext += "<img src=\"Icon."+str(icon)+"\" width=32 height=32>"
htmltext += "<font color=LEVEL>" + itemTemplate.getName() + ""+pgrade+" " + enchant + "</font><br><br>"
htmltext += "Количество: "+count+"<br>"
htmltext += "Установите цену: <br>"
htmltext += "<edit var=\"price\" width=250><br><button value=\"Ok\" action=\"bypass -h Quest q8033_MarketSell $price\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
htmltext += "<br>*установите цену за 1 предмет, конечная цена = кол-во*цену.</body></html>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
#else :
#htmltext = "<html><body>Market:<br>Oops!</body></html>"
elif event >= 0 or event <=2144000000:
itemPrice = int(event)
itemObjId = st.getInt("sellitem")
itemCount = st.getInt("count")
itemGrade = st.getInt("grade")
itemPrice = int(itemPrice*itemCount)
Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
itemTemplate = Item.getItem()
idtest = Item.getItemId()
itype = str(Item.getItemType())
itemType = str(Item.getItemType())
if Item and not Item.isEquipped() :
count = str(itemCount)
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
#weapons
if itype == "Sword":
ptype = str ("Weapon")
elif itype == "Blunt":
ptype = str ("Weapon")
elif itype == "Dagger":
ptype = str ("Weapon")
elif itype == "Bow":
ptype = str ("Weapon")
elif itype == "Etc":
ptype = str ("Weapon")
elif itype == "Pole":
ptype = str ("Weapon")
elif itype == "Fist":
ptype = str ("Weapon")
elif itype == "Dual Sword":
ptype = str ("Weapon")
elif itype == "Dual Fist":
ptype = str ("Weapon")
elif itype == "Big Sword":
ptype = str ("Weapon")
elif itype == "Big Blunt":
ptype = str ("Weapon")
#armor
elif itype == "Shield":
ptype = str ("Armor")
elif itype == "Light":
ptype = str ("Armor")
elif itype == "Heavy":
ptype = str ("Armor")
elif itype == "Magic":
ptype = str ("Armor")
elif itype == "None":
ptype = str ("Armor")
#recipes
elif itype == "Receipe":
ptype = str ("Recipe")
#resources
elif itype == "Material":
ptype = str ("Resource")
#spellbook
elif itype == "Spellbook":
ptype = str ("Spellbook")
#soulshot
elif itype == "Shot":
ptype = str ("Soulshot")
st.getPlayer().destroyItem("q8033_MarketSell",itemObjId, itemCount, st.getPlayer(), 0)
st.getPlayer().sendPacket(SystemMessage.sendString(""+count+ " " + itemTemplate.getName() + "" + enchant + " выстановлено на аукцион за "+str(itemPrice)+" adena"));
htmltext = "<html><body>Market:<br>Выстановлено на аукцион:<br><font color=LEVEL>"+count+" " + itemTemplate.getName() + "" + enchant + "</font> за "+str(itemPrice)+" adena"
#=====#
itemname = "" + itemTemplate.getName() + "" + enchant + ""
enchLvl=Item.getEnchantLevel()
ownerid = st.getPlayer().getObjectId()
name = st.getPlayer().getName()
con=L2DatabaseFactory.getInstance().getConnection()
insertion=con.prepareStatement("INSERT INTO z_market_sell (ownerId,char_name,ItemName,enchLvl,itemGrade,l2Type,itemType,itemId,itemObjId,count,prise) VALUES (?,?,?,?,?,?,?,?,?,?,?)")
insertion.setInt(1, ownerid)
insertion.setString(2, name)
insertion.setString(3, itemname)
insertion.setInt(4, enchLvl)
insertion.setInt(5, itemGrade)
insertion.setString(6, ptype)
insertion.setString(7, itemType)
insertion.setInt(8, idtest)
insertion.setInt(9, itemObjId)
insertion.setInt(10, itemCount)
insertion.setInt(11, itemPrice)
try :
insertion.executeUpdate()
insertion.close()
con.close()
except :
try : con.close()
except : pass
else :
htmltext = "<html><body>Market:<br>Oops!</body></html>"
else:
htmltext = "<html><body>Market:<br>Oops!</body></html>"
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
npcId = npc.getNpcId()
if npcId == MARKET:
htmltext = "privetstvie.htm"
return htmltext
QUEST = Quest(8033,qn,"custom")
CREATED = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(MARKET)
QUEST.addTalkId(MARKET)
q8034_MarketPrivate
import sys
from java.lang import System
from java.util import Iterator
from com.l2jcore.util.database import L2DatabaseFactory
from com.l2jcore.Game.network.serverpackets import CreatureSay
from com.l2jcore.Game.model.quest import State
from com.l2jcore.Game.model.quest import QuestState
from com.l2jcore.Game.model.quest.jython import QuestJython as JQuest
from com.l2jcore.Game.network.serverpackets import SystemMessage
from com.l2jcore.Game.model.actor.instance import L2ItemInstance
from com.l2jcore.util.random import Rnd
qn = "q8034_MarketPrivate"
MARKET = 80007
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 == "list" :
htmltext = "<html><body>Cписок выставленных товаров:<br1>*нажмите на предмет, чтобы снять с продажи<br>"
htmltext += "<table width=300><tr><td></td><td>Предмет</td></tr>"
ownerid = st.getPlayer().getObjectId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE mag.ownerId=? AND magicon.itemId=mag.itemId")
listitems.setInt(1, ownerid)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
if count > 1:
count = str(count)
else:
count=str("")
if price >= 10000:
price = "<font color=00CCFF>"+str(price)+"</font>"
elif price >= 100000:
price = "<font color=FF0099>"+str(price)+"</font>"
elif price >= 1000000:
price = "<font color=FFCC00>"+str(price)+"</font>"
elif price >= 10000000:
price = "<font color=00FF66>"+str(price)+"</font>"
elif price >= 100000000:
price = "<font color=33CCCC>"+str(price)+"</font>"
elif price >= 1000000000:
price = "<font color=FF0066>"+str(price)+"</font>"
else:
price = "<font color=FFFFFF>"+str(price)+"</font>"
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8034_MarketPrivate nafig_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(price)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
if event == "selllist" :
htmltext = "<html><body>Cписок проданных товаров:<br>"
htmltext += "<table width=300><tr><td>Предмет</td><td>Адена</td></tr>"
ownerid = st.getPlayer().getObjectId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT ownerId,ItemName,itemObjId,prise FROM z_market_private WHERE ownerId=?")
listitems.setInt(1, ownerid)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
itemname=rs.getString("ItemName")
itemobj=rs.getInt("itemObjId")
price=rs.getInt("prise")
try :
htmltext += "<tr><td><a action=\"bypass -h Quest q8034_MarketPrivate otdai_"+str(itemobj)+"\">"+str(itemname)+"</a></td><td>"+str(price)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("nafig_"):
itemObjId = int(event.replace("nafig_", ""))
#=====#
conn=L2DatabaseFactory.getInstance().getConnection()
delitem=conn.prepareStatement("SELECT ownerId,char_name,ItemName,enchLvl,itemGrade,itemType,itemId,itemObjId,count,prise FROM z_market_sell WHERE itemObjId=?")
delitem.setInt(1, itemObjId)
rs=delitem.executeQuery()
while (rs.next()) :
owner=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
try :
st.giveItems(item,count)
st.getPlayer().sendPacket(SystemMessage.sendString("Предмет "+str(count)+" "+(itemname)+" снят с аукциона!"));
htmltext = "<html><body>Предмет <font color=LEVEL>"+str(count)+" "+(itemname)+"</font>снят с аукциона!<br></body></html>"
#
#
con=L2DatabaseFactory.getInstance().getConnection()
ubrano=con.prepareStatement("DELETE FROM z_market_private WHERE itemObjId = ?")
ubrano.setInt(1, itemobj)
try :
ubrano.executeUpdate()
ubrano.close()
con.close()
except :
try : con.close()
except : pass
except :
try : insertion.close()
except : pass
try :
conn.close()
except :
pass
elif event.startswith("otdai_"):
itemObjId = int(event.replace("otdai_", ""))
#=====#
conn=L2DatabaseFactory.getInstance().getConnection()
delitem=conn.prepareStatement("SELECT ownerId,ItemName,itemObjId,prise FROM z_market_private WHERE itemObjId=?")
delitem.setInt(1, itemObjId)
rs=delitem.executeQuery()
while (rs.next()) :
owner=rs.getInt("ownerId")
itemname=rs.getString("ItemName")
itemobj=rs.getInt("itemObjId")
price=rs.getInt("prise")
try :
st.giveItems(4037,price)
st.getPlayer().sendPacket(SystemMessage.sendString("Получено "+str(price)+" adena с продажи "+(itemname)+"!"));
htmltext = "<html><body>Получено "+str(price)+" adena с продажи <font color=LEVEL>"+(itemname)+"</font>!<br></body></html>"
#
#
con=L2DatabaseFactory.getInstance().getConnection()
ubrano=con.prepareStatement("DELETE FROM z_market_private WHERE itemObjId = ?")
ubrano.setInt(1, itemobj)
try :
ubrano.executeUpdate()
ubrano.close()
con.close()
except :
try : con.close()
except : pass
except :
try : insertion.close()
except : pass
try :
conn.close()
except :
pass
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
npcId = npc.getNpcId()
if npcId == MARKET:
htmltext = "privetstvie.htm"
return htmltext
QUEST = Quest(8034,qn,"custom")
CREATED = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(MARKET)
QUEST.addTalkId(MARKET)
from java.lang import System
from java.util import Iterator
from com.l2jcore.util.database import L2DatabaseFactory
from com.l2jcore.Game.network.serverpackets import CreatureSay
from com.l2jcore.Game.model.quest import State
from com.l2jcore.Game.model.quest import QuestState
from com.l2jcore.Game.model.quest.jython import QuestJython as JQuest
from com.l2jcore.Game.network.serverpackets import SystemMessage
from com.l2jcore.Game.model.actor.instance import L2ItemInstance
from com.l2jcore.util.random import Rnd
qn = "q8034_MarketPrivate"
MARKET = 80007
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 == "list" :
htmltext = "<html><body>Cписок выставленных товаров:<br1>*нажмите на предмет, чтобы снять с продажи<br>"
htmltext += "<table width=300><tr><td></td><td>Предмет</td></tr>"
ownerid = st.getPlayer().getObjectId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT * FROM `z_market_sell` mag, `z_market_icons` magicon WHERE mag.ownerId=? AND magicon.itemId=mag.itemId")
listitems.setInt(1, ownerid)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
icon=rs.getString("itemIcon")
try :
if count > 1:
count = str(count)
else:
count=str("")
if price >= 10000:
price = "<font color=00CCFF>"+str(price)+"</font>"
elif price >= 100000:
price = "<font color=FF0099>"+str(price)+"</font>"
elif price >= 1000000:
price = "<font color=FFCC00>"+str(price)+"</font>"
elif price >= 10000000:
price = "<font color=00FF66>"+str(price)+"</font>"
elif price >= 100000000:
price = "<font color=33CCCC>"+str(price)+"</font>"
elif price >= 1000000000:
price = "<font color=FF0066>"+str(price)+"</font>"
else:
price = "<font color=FFFFFF>"+str(price)+"</font>"
htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8034_MarketPrivate nafig_"+str(itemobj)+"\">"+count+" "+str(itemname)+"</a> <br1> Цена: "+str(price)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
if event == "selllist" :
htmltext = "<html><body>Cписок проданных товаров:<br>"
htmltext += "<table width=300><tr><td>Предмет</td><td>Адена</td></tr>"
ownerid = st.getPlayer().getObjectId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT ownerId,ItemName,itemObjId,prise FROM z_market_private WHERE ownerId=?")
listitems.setInt(1, ownerid)
rs=listitems.executeQuery()
while (rs.next()) :
obj=rs.getInt("ownerId")
itemname=rs.getString("ItemName")
itemobj=rs.getInt("itemObjId")
price=rs.getInt("prise")
try :
htmltext += "<tr><td><a action=\"bypass -h Quest q8034_MarketPrivate otdai_"+str(itemobj)+"\">"+str(itemname)+"</a></td><td>"+str(price)+"</td></tr>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
htmltext += "</table></body></html>"
elif event.startswith("nafig_"):
itemObjId = int(event.replace("nafig_", ""))
#=====#
conn=L2DatabaseFactory.getInstance().getConnection()
delitem=conn.prepareStatement("SELECT ownerId,char_name,ItemName,enchLvl,itemGrade,itemType,itemId,itemObjId,count,prise FROM z_market_sell WHERE itemObjId=?")
delitem.setInt(1, itemObjId)
rs=delitem.executeQuery()
while (rs.next()) :
owner=rs.getInt("ownerId")
nick=rs.getString("char_name")
itemname=rs.getString("ItemName")
ench=rs.getInt("enchLvl")
item=rs.getInt("itemId")
grade=rs.getInt("itemGrade")
itype=rs.getString("itemType")
itemobj=rs.getInt("itemObjId")
count=rs.getInt("count")
price=rs.getInt("prise")
try :
st.giveItems(item,count)
st.getPlayer().sendPacket(SystemMessage.sendString("Предмет "+str(count)+" "+(itemname)+" снят с аукциона!"));
htmltext = "<html><body>Предмет <font color=LEVEL>"+str(count)+" "+(itemname)+"</font>снят с аукциона!<br></body></html>"
#
#
con=L2DatabaseFactory.getInstance().getConnection()
ubrano=con.prepareStatement("DELETE FROM z_market_private WHERE itemObjId = ?")
ubrano.setInt(1, itemobj)
try :
ubrano.executeUpdate()
ubrano.close()
con.close()
except :
try : con.close()
except : pass
except :
try : insertion.close()
except : pass
try :
conn.close()
except :
pass
elif event.startswith("otdai_"):
itemObjId = int(event.replace("otdai_", ""))
#=====#
conn=L2DatabaseFactory.getInstance().getConnection()
delitem=conn.prepareStatement("SELECT ownerId,ItemName,itemObjId,prise FROM z_market_private WHERE itemObjId=?")
delitem.setInt(1, itemObjId)
rs=delitem.executeQuery()
while (rs.next()) :
owner=rs.getInt("ownerId")
itemname=rs.getString("ItemName")
itemobj=rs.getInt("itemObjId")
price=rs.getInt("prise")
try :
st.giveItems(4037,price)
st.getPlayer().sendPacket(SystemMessage.sendString("Получено "+str(price)+" adena с продажи "+(itemname)+"!"));
htmltext = "<html><body>Получено "+str(price)+" adena с продажи <font color=LEVEL>"+(itemname)+"</font>!<br></body></html>"
#
#
con=L2DatabaseFactory.getInstance().getConnection()
ubrano=con.prepareStatement("DELETE FROM z_market_private WHERE itemObjId = ?")
ubrano.setInt(1, itemobj)
try :
ubrano.executeUpdate()
ubrano.close()
con.close()
except :
try : con.close()
except : pass
except :
try : insertion.close()
except : pass
try :
conn.close()
except :
pass
return htmltext
def onTalk (self,npc,player):
st = player.getQuestState(qn)
npcId = npc.getNpcId()
if npcId == MARKET:
htmltext = "privetstvie.htm"
return htmltext
QUEST = Quest(8034,qn,"custom")
CREATED = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(MARKET)
QUEST.addTalkId(MARKET)
Добавлено через 2 часа 11 минут
Ап! Ап! Ап! Ап! Ап! Ап!