Форум сайта python.su
Здравствуйте уважаемые.
Я в python не силен, способен только на мелкое редактирование и поэтому обращаюсь к вам уважаемые знатоки
Есть скрипт
Целым его показывать смысла невижу, покажу ту часть над которой пытаюсь разобраться.
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"
#spellbook
elif itype == "Spellbook":
ptype = str ("Spellbook")
#soulshot
elif itype == "Shot":
ptype = str ("Soulshot")
+ if st.getQuestItemsCount(57) >= 2500:
+ st.takeItems(57,2500)
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"
#spellbook
elif itype == "Spellbook":
ptype = str ("Spellbook")
#soulshot
elif itype == "Shot":
ptype = str ("Soulshot")
+ st.takeItems(57,2500)
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"
Офлайн