Dextron 2 Опубликовано 18 ноября, 2016 Парни, помогайте. Есть аукцион. Все работает, но вещь при добавлении (не важно оружие, бижа), не появляется в списке пока не будет заточено минимум на +4 Что-то смотрю скрипт и не могу найти где же эта проверка PAGE_LIMIT = 10 PAGE_LIMIT_TOP = 4 SORT_LIMIT = 8 MAX_ADENA = 2147000000 # CENCH = "CCCC33" CPRICE = "669966" CITEM = "bf196b" CAUG1 = "37a6de" CAUG2 = "1278ab" COLOR_PRICE = "777777" COLOR_PRICE2 = "a7f00a" CITEM_TOP = "b0e053" COLOR_PRICE_TOP = "777777" CITEM_TOP2 = "f4ec1c" COLOR_PRICE_TOP2 = "777777" TOP_PRICE_BEST = 10 TOP_PRICE_YELLOW = 6 TOP_PRICE_BOTH = 15 moneys = {4037: "Монета Удачи", 6673: "Монета Чемпионов", 9998: "Медаль Победителя", 57: "Adena"} sorts = {0: "Оружие", 1: "Броня", 2: "Бижутерия"} moneys_black = {4037: "Монета Удачи", 6673: "Монета Чемпионов", 9998: "Медаль Победителя", 57: "Adena"} LUCERA = 1 BLACK_MARKET = 0 TOP_ITEMS = 0 AUGMENT_TAX = 1 AUGMENT_TAX_ID = 57 OTHER_TAX = {3: 0, 4: 0, 5: 0} OTHER_TAX_ID = 57 BUTTON_DECO = "back=\"Atelon-pvp-ru.just2Atelon2\" fore=\"Atelon-pvp-ru.just2Atelon\"" print "purchase: ok" class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def init_LoadGlobalData(self) : if LUCERA == 2: IconTable.getInstance() #print "purchase: ok" def closeStat(self,st): if st != None: st.close() return def closeRes(self,rs): if rs != None: rs.close() return def closeCon(self,con): if con != None: con.close() return def getIcon(self,con,iid): if LUCERA == 2: return IconTable.getInstance().getIcon(iid) return IconTable.getIcon(iid) def getMoneyCall(self,money): return moneys.get(money, str("none")) def getMoneyBlackCall(self,money): return moneys_black.get(money, "none") def canBeStoredEnch(self,item): if item.getEnchantLevel() <= 0: return False if item.isHeroItem(): return False if item.isShadowItem(): return False if item.isEquipped(): return False if item.getItem().getDuration() >= 0: return False if item.getItem().getCrystalType() < 4 and item.getItemId() != 6660: return False if item.getItemId() in FORBIDDEN: return False if item.getItemId() == 8190 or item.getItemId() == 8689: return False return True def canBeEnchanted(self,item): if item.isHeroItem(): return False if item.isShadowItem(): return False if item.getItemId() == 8190 or item.getItemId() == 8689: return False return True def getSellerName(self,con,charId): player = L2World.getInstance().getPlayer(charId) if player != None: return "<font color=3d9725>"+player.getName()+"</font>" name = "???" try: st = con.prepareStatement("SELECT char_name FROM `characters` WHERE `charId`=? LIMIT 1"); st.setInt(1, charId); rs = st.executeQuery(); if rs.next(): name = rs.getString("char_name") except: pass if rs != None: rs.close() if st != None: st.close() return name def getAugmentSkill(self, aid, lvl, full, player): augment = SkillTable.getInstance().getInfo(aid, lvl) if augment == None: return "" if not augment.isAugment(): return "" augName = augment.getName(); stype = "Шанс"; ttype = ""; power = ":" + str(int(augment.getPower())) + "power"; if augment.isActive(): stype = "Актив" if augment.isAuraSkill(): stype = "Массовый"; elif augment.isPassive(): stype = "Пассив" power = ""; if augment.getPower() == 0: power = "" if full: ttype = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/augment_info_descriptions.htm", player) ttype = ttype.replace("%AUG_DESCS%", augment.getAugInfo()) augName = augName.replace("Item Skill: ", ""); auginfo = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/augment_info.htm", player) auginfo = auginfo.replace("%AUG_NAME%", augName) auginfo = auginfo.replace("%AUG_LVL%", str(lvl)) auginfo = auginfo.replace("%STYPE%", stype) auginfo = auginfo.replace("%POWER%", power) auginfo = auginfo.replace("%DESCRIPTIONS%", ttype) return auginfo def getPageCount(self, con, me, itemId, augment, type2, charId, name, ench, black): rowCount = 0 pages = 0 try: if black == 1: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_black` WHERE `type` = ?") st.setInt(1, 50) elif type2 >= 0: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `type` = ?") st.setInt(1, type2) elif itemId > 0: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `itemId` = ?") st.setInt(1, itemId) elif augment > 0: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `augment` = ?") st.setInt(1, augment) elif name != "": if ench == 0: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `itemName` LIKE ?") st.setString(1, "%"+ name +"%") else: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `itemName` LIKE ? AND `enchant` = ?") st.setString(1, "%"+ name +"%") st.setInt(2, ench) elif ench > 0: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `enchant` = ?") st.setInt(1, ench) elif me == 1: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `ownerId` = ?") st.setInt(1, charId) else: st=con.prepareStatement("SELECT COUNT(`id`) FROM `z_stock_items` WHERE `id` > 0") rs=st.executeQuery() if (rs.next()): rowCount = rs.getInt(1) except : pass if rs != None: rs.close() if st != None: st.close() if rowCount == 0: return "0" pages = (rowCount / PAGE_LIMIT) + 1 return str(pages) def error(self,action, text): return "<html><body> " + action + ": <br> " + text + "</body></html>" def getMainMenu(self, player): if BLACK_MARKET == 0: return HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/main_menu.htm", player) return HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/main_menu_black.htm", player) def transferPay(self,con,charId,itemId,enchant,augattr,augment,auhLevel,price,money,owner): item = ItemTable.getInstance().getTemplate(money) if item == None: return False return GiveItem.insertItem(con, charId, money, price, 0, 0, 0, 0, PAYMENT_LOC, owner) def getTopItems(self,player): text = TextBuilder("<br><table width=300><tr><td width=36></td><td width=264>") text.append("<font color=" + CITEM_TOP + ">***** Лучшие предложения *****</font></td></tr>") con = None rs = None st = None try: con=L2DatabaseFactory.getInstance().getConnection() st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow FROM `z_stock_items` WHERE `top` IN (?,?) ORDER BY RAND() LIMIT ?") st.setInt(1, 1) st.setInt(2, 3) st.setInt(3, PAGE_LIMIT_TOP) rs=st.executeQuery() while (rs.next()): sId = rs.getInt("id") itmId = rs.getInt("itemId") ownerId = rs.getInt("ownerId") brokeItem = ItemTable.getInstance().getTemplate(itmId) if brokeItem == None: continue priceB = "<font color="+COLOR_PRICE_TOP+">" + str(Util.formatNumber(rs.getInt("price"))) + " " + self.getMoneyCall(rs.getInt("money")) + "; \"" + self.getSellerName(con,ownerId) + "</font>" if player.getObjectId() == ownerId: priceB = "<table width=240><tr><td width=160><font color=" + COLOR_PRICE_TOP + ">" + str(Util.formatNumber(rs.getInt("price"))) + " " + self.getMoneyCall(rs.getInt("money")) + ";</font></td><td align=right><button value=\"X\" action=\"bypass -h Quest purchase StockBuyItem_" + str(sId) + "_ 1 _ 1\" width=25 height=15 "+BUTTON_DECO+"></td></tr></table><br1>" text.append("<tr><td><img src=\"" + self.getIcon(con, itmId) + "\" width=32 height=32></td><td><a action=\"bypass -h Quest purchase StockShowItem_" + str(sId) + "_1\"> <font color="+CITEM_TOP+">" + brokeItem.getName() + "</font></a><font color="+CENCH+">+" + str(rs.getInt("enchant")) + "</font> <br1> " +priceB+ " <br1>" + self.getAugmentSkill(rs.getInt("augment"), rs.getInt("augLvl"), False, player) + "</td></tr>"); except: pass if rs != None: rs.close() if st != None: st.close() text.append("</table><img src=\"sek.cbui176\" width=310 height=1>"); if con != None: con.close() return text.toString() def showSellItems(self,player, page, me, last, itemId, augment, type2, name, ench, black): text = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/list_items.htm", player) HPAGE = "" if last == 1: HPAGE = "Последние " + str(PAGE_LIMIT) + ":" else: HPAGE = "Страница " + str(page) + ":" text = text.replace("%PAGE%", HPAGE) limit1 = (page-1) * PAGE_LIMIT limit2 = PAGE_LIMIT if page == 1 and black == 0: limit2 -= PAGE_LIMIT_TOP con = None rs = None st = None try: con=L2DatabaseFactory.getInstance().getConnection() if black == 1: st=con.prepareStatement("SELECT id, itemId, total, count, price, money, ownerId, shadow FROM `z_stock_black` WHERE `type` = ? ORDER BY `id` DESC LIMIT ?, ?") st.setInt(1, 50) st.setInt(2, limit1) st.setInt(3, limit2) elif type2 >= 0: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` WHERE `type` = ? ORDER BY `id` DESC LIMIT ?, ?") st.setInt(1, type2) st.setInt(2, limit1) st.setInt(3, limit2) elif itemId > 0: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` WHERE `itemId` = ? ORDER BY `id` DESC LIMIT ?, ?") st.setInt(1, itemId) st.setInt(2, limit1) st.setInt(3, limit2) elif augment > 0: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` WHERE `augment` = ? ORDER BY `id` DESC LIMIT ?, ?") st.setInt(1, augment) st.setInt(2, limit1) st.setInt(3, limit2) elif name != "": if ench == 0: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` WHERE `itemName` LIKE ? ORDER BY `id` DESC LIMIT ?, ?") st.setString(1, "%"+ name +"%") st.setInt(2, limit1) st.setInt(3, limit2) else: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` WHERE `itemName` LIKE ? AND `enchant` = ? ORDER BY `id` DESC LIMIT ?, ?") st.setString(1, "%"+ name +"%") st.setInt(2, ench) st.setInt(3, limit1) st.setInt(4, limit2) elif ench > 0: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` WHERE `enchant` = ? ORDER BY `id` DESC LIMIT ?, ?") st.setInt(1, ench) st.setInt(2, limit1) st.setInt(3, limit2) elif me == 1: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` WHERE `ownerId` = ? ORDER BY `id` DESC LIMIT ?, ?") st.setInt(1, player.getObjectId()) st.setInt(2, limit1) st.setInt(3, limit2) else: st=con.prepareStatement("SELECT id, itemId, enchant, augment, augLvl, price, money, ownerId, shadow, top FROM `z_stock_items` ORDER BY `id` DESC LIMIT ?, ?") st.setInt(1, limit1) st.setInt(2, limit2) rs=st.executeQuery() LIST_ITEMS = "" PRICE_BLACK = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/price_black.htm", player) PRICE_BLACK_OWNER = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/price_black_owner.htm", player) LIST_ITEMS_BLACK = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/list_items_lot_black.htm", player) PRICE = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/price.htm", player) PRICE_OWNER = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/price_owner.htm", player) LIST_ITEMSN = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/list_items_lot.htm", player) while (rs.next()): sId = rs.getInt("id") itmId = rs.getInt("itemId") ownerId = rs.getInt("ownerId") brokeItem = ItemTable.getInstance().getTemplate(itmId) if brokeItem == None: continue HPRICEB = "" if black == 1: HPRICEB = PRICE_BLACK.replace("%COUNT%", str(Util.formatNumber(rs.getInt("count")))) HPRICEB = HPRICEB.replace("%PRICE%", str(Util.formatNumber(rs.getInt("price")))) HPRICEB = HPRICEB.replace("%MONEY%", self.getMoneyBlackCall(rs.getInt("money"))) HPRICEB = HPRICEB.replace("%SELLER%", self.getSellerName(con,ownerId)) if player.getObjectId() == ownerId: HPRICEB = PRICE_BLACK_OWNER.replace("%COUNT%", str(Util.formatNumber(rs.getInt("count")))) HPRICEB = HPRICEB.replace("%PRICE%", str(Util.formatNumber(rs.getInt("price")))) HPRICEB = HPRICEB.replace("%MONEY%", self.getMoneyBlackCall(rs.getInt("money"))) HPRICEB = HPRICEB.replace("%ID%", str(sId)) HPRICEB = HPRICEB.replace("%TOTAL%", str(rs.getInt("total"))) HLISTB = LIST_ITEMS_BLACK.replace("%ID%", str(sId)) HLISTB = HLISTB.replace("%TOTAL%", str(rs.getInt("total"))) HLISTB = HLISTB.replace("%ICON%", self.getIcon(con, itmId)) HLISTB = HLISTB.replace("%ITEM_NAME%", brokeItem.getName()) HLISTB = HLISTB.replace("%PRICE%", HPRICEB) LIST_ITEMS += HLISTB else: clr_sel = "" clr_item = CITEM clr_price = COLOR_PRICE if rs.getInt("top") >= 2: clr_sel = "<img src=\"sek.cbui176\" width=7 height=32>" clr_item = CITEM_TOP2 clr_price = COLOR_PRICE_TOP2 HPRICEB = PRICE.replace("%PRICE%", str(Util.formatNumber(rs.getInt("price")))) HPRICEB = HPRICEB.replace("%MONEY%", self.getMoneyBlackCall(rs.getInt("money"))) HPRICEB = HPRICEB.replace("%SELLER%", self.getSellerName(con,ownerId)) if player.getObjectId() == ownerId: HPRICEB = PRICE_OWNER.replace("%PRICE%", str(Util.formatNumber(rs.getInt("price")))) HPRICEB = HPRICEB.replace("%MONEY%", self.getMoneyBlackCall(rs.getInt("money"))) HPRICEB = HPRICEB.replace("%ID%", str(sId)) HLISTB = LIST_ITEMSN.replace("%ID%", str(sId)) HLISTB = HLISTB.replace("%ICON%", self.getIcon(con, itmId)) HLISTB = HLISTB.replace("%ITEM_NAME%", brokeItem.getName()) HLISTB = HLISTB.replace("%PRICE%", HPRICEB) HLISTB = HLISTB.replace("%ENCHANT%", str(rs.getInt("enchant"))) HLISTB = HLISTB.replace("%AUGMENT%", self.getAugmentSkill(rs.getInt("augment"), rs.getInt("augLvl"), False, player)) LIST_ITEMS += HLISTB except: pass if rs != None: rs.close() if st != None: st.close() text = text.replace("%LIST_ITEMS%", LIST_ITEMS) HLAST = "" if last == 1: HLAST = "<br>" else: pages = int(self.getPageCount(con, me, itemId, augment, type2,player.getObjectId(), name, ench, black)) if pages >= 2: HLAST = self.sortPages(page,pages,me,itemId,augment,type2, black, name, ench) text = text.replace("%LAST%", HLAST) if con != None: con.close() return text def sortPages(self,page,pages,me,itemId,augment,type2, black, name, ench): text = TextBuilder("<br>Страницы:<br1><table width=300><tr>") step = 1 s = page - 3 f = page + 3 if page < SORT_LIMIT and s < SORT_LIMIT: s = 1 if page >= SORT_LIMIT: text.append("<td><a action=\"bypass -h Quest purchase StockShowPage_" + str(s) + "_" + str(me) + "_" + str(itemId) + "_" + str(augment) + "_" + str(type2) + "_" + str(black) + "_" + str(name) + "_" + str(ench) + "\"> ... </a></td>") for i in range(s,(pages+1)): al = i + 1 if i == page: text.append("<td>" + str(i) + "</td>") else: if al <= pages: text.append("<td><a action=\"bypass -h Quest purchase StockShowPage_" + str(i) + "_" + str(me) + "_" + str(itemId) + "_" + str(augment) + "_" + str(type2) + "_" + str(black) + "_" + str(name) + "_" + str(ench) + "\">" + str(i) + "</a></td>") if step == SORT_LIMIT and f < pages: if al < pages: text.append("<td><a action=\"bypass -h Quest purchase StockShowPage_" + str(al) + "_" + str(me) + "_" + str(itemId) + "_" + str(augment) + "_" + str(type2) + "_" + str(black) + "_" + str(name) + "_" + str(ench) + "\"> ... </a></td>") break step+=1 #< if page == 1 and pages == 2: text.append("<td><a action=\"bypass -h Quest purchase StockShowPage_" + str(pages) + "_" + str(me) + "_" + str(itemId) + "_" + str(augment) + "_" + str(type2) + "_" + str(black) + "_" + str(name) + "_" + str(ench) + "\">" + str(pages) + "</a></td>") #< text.append("</tr></table><br>") htmltext = text.toString() text.clear() return htmltext def clearVars(self,player): quest = player.getQuestState(qn) quest.unset("objId") quest.unset("augment") quest.unset("enchant") return def onAdvEvent (self,event,npc,player): if player.getActiveTradeList() != None: player.cancelActiveTrade() return self.error("Просмотр шмотки","Ошибка запроса; 0x101") if player.isProcessingTransaction() or player.getActiveWarehouse() != None: return self.error("Просмотр шмотки","Ошибка запроса; 0x102") if player.getPrivateStoreType() != 0 or player.getTrading(): return self.error("Просмотр шмотки","Ошибка запроса; 0x103") if player.getActiveEnchantItem() != None: player.setActiveEnchantItem(None) return self.error("Просмотр шмотки","Ошибка запроса; 0x104") #< quest = player.getQuestState(qn) if event == "list": htmltext = "<html><body>" + self.getMainMenu(player) + "<br>" htmltext += self.showSellItems(player, 1, 0, 0, 0, 0, -1, "", 0, 0) htmltext += "<br></body></html>" return htmltext elif event.startswith("StockShowPage_"): search = str(event.replace("StockShowPage_", "")) page,me,itemId,augment,type2,black,name,ench=search.split("_") if page == "" or me == "" or augment == "" or itemId == "" or type2 == "" or black == "" or ench == "": return self.error("Листание страниц","Ошибка запроса") page,me,itemId,augment,type2,black,ench=int(page),int(me),int(itemId),int(augment),int(type2),int(black),int(ench) if me == 1: stype = "Мои шмотки" htmltext = "<html><body>" + self.getMainMenu(player) + "<br><br1>" htmltext += self.showSellItems(player, page, me, 0, itemId, augment, type2, name, ench, black) htmltext += "<br></body></html>" return htmltext elif event.startswith("StockShowItem_"): #sellId = event.replace("StockShowItem_", "") search = str(event.replace("StockShowItem_", "")) sellId,black=search.split("_") if sellId == "" or black == "": return self.error("Просмотр шмотки","Ошибка запроса") try: black=int(black) sellId=int(sellId) except: sellId = -30 if sellId == -30: return self.error("Просмотр шмотки","Ошибка запроса") text = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/show_lot.htm", player) if black == 50: text = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/show_lot_black.htm", player) try: con = L2DatabaseFactory.getInstance().getConnection(); if black == 50: st = con.prepareStatement("SELECT itemId, total, count, price, money, ownerId, shadow FROM `z_stock_black` WHERE `id`=? LIMIT 1"); else: st = con.prepareStatement("SELECT itemId, enchant, augment, augLvl, price, money, ownerId, shadow FROM `z_stock_items` WHERE `id`=? LIMIT 1"); st.setInt(1, sellId); rs = st.executeQuery(); if rs.next(): itemId = rs.getInt("itemId"); brokeItem = ItemTable.getInstance().getTemplate(itemId); if brokeItem == None: return self.error("Просмотр шмотки","Ошибка запроса") money = rs.getInt("money"); if black == 50: enchant = rs.getInt("total"); augment = rs.getInt("count"); valute = self.getMoneyBlackCall(money); else: enchant = rs.getInt("enchant"); augment = rs.getInt("augment"); auhLevel = rs.getInt("augLvl"); valute = self.getMoneyCall(money); text = text.replace("%ID%", str(itemId)) price = rs.getInt("price"); charId = rs.getInt("ownerId"); shadow = rs.getInt("shadow"); #< if black == 50: text.append("<table width=300><tr><td><img src=\"" + self.getIcon(con, itemId) + "\" width=32 height=32></td><td><font color=LEVEL>" + str(Util.formatNumber(enchant)) + " " + brokeItem.getName() + "</font><br></td></tr></table><br><br>") else: text = text.replace("%ICON%", self.getIcon(con, itemId)) text = text.replace("%ITEM_NAME%", brokeItem.getName()) text = text.replace("%ENCHANT%", str(enchant)) text = text.replace("%SELLER%", self.getSellerName(con,charId)) if black != 50: text = text.replace("%AUGMENT%", self.getAugmentSkill(augment, auhLevel, True, player)) if augment > 0: aug_more = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/show_lot_find_aug_button.htm", player) aug_more = aug_more.replace("%AUG_ID%", str(augment)) text = text.replace("%AUGMENT_MORE_BUTTON%", aug_more) else: text = text.replace("%AUGMENT_MORE_BUTTON%", "") if player.getObjectId() == charId: if black == 50: text.append("<button value=\"Забрать\" action=\"bypass -h Quest purchase StockBuyItem_" + str(sellId) + "_ " + str(rs.getInt("total")) + " _ 50\" width=60 height=15 "+BUTTON_DECO+"><br>") else: owner_button = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/show_lot_owner_button.htm", player) owner_button = owner_button.replace("%ID%", str(sellId)) text = text.replace("%OWNER_BUTTON%", owner_button) text = text.replace("%BUY_BUTTON%", "") else: text = text.replace("%OWNER_BUTTON%", "") payment = player.getInventory().getItemByItemId(money); fprice = str(Util.formatNumber(price)) if payment != None and payment.getCount() >= price: if black == 50: player.sendPacket(ShowCalculator(4393)) text.append("<font color=33CC00>Курс обмена: <br1>" + str(Util.formatNumber(augment)) + " " + self.getMoneyBlackCall(itemId) + " = " + fprice+ " " + str(valute) + "</font><br>"); text.append("Сколько вы хотите купить " + self.getMoneyBlackCall(itemId) + "?<br><edit var=\"count\" width=70 length=\"16\"><br><button value=\"Купить\" action=\"bypass -h Quest purchase StockBuyItem_" + str(sellId) + "_ $count _ 50\" width=60 height=15 "+BUTTON_DECO+"><br>") else: buyb = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/show_lot_buy_button.htm", player) buyb = buyb.replace("%PRICE%", fprice) buyb = buyb.replace("%MONEY%", str(valute)) buyb = buyb.replace("%ID%", str(sellId)) text = text.replace("%BUY_BUTTON%", buyb) else: no_money = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/show_lot_no_money.htm", player) no_money = no_money.replace("%PRICE%", fprice) no_money = no_money.replace("%MONEY%", str(valute)) text = text.replace("%BUY_BUTTON%", no_money) else: if rs != None: rs.close() if st != None: st.close() if con != None: con.close() return self.error("Просмотр шмотки","Ни найдена или уже купили") except: pass if rs != None: rs.close() if st != None: st.close() if con != None: con.close() if black == 50: text = text.replace("%BACK%", "black_market") else: text = text.replace("%BACK%", "list") return text elif event.startswith("StockBuyItem_"): #sellId = event.replace("StockBuyItem_", "") search = str(event.replace("StockBuyItem_", "")) sellId,count,black=search.split("_") if sellId == "" or count == "" or black == "": return self.error("Покупка шмотки","Ошибка запроса1") count = str(count.replace(" ", "")) black = str(black.replace(" ", "")) try: count=int(count) black=int(black) sellId=int(sellId) except: sellId = -30 if sellId == -30: return self.error("Покупка шмотки","Ошибка запроса2") try: con = L2DatabaseFactory.getInstance().getConnection(); if black == 50: st = con.prepareStatement("SELECT itemId, itemName, total, count, price, money, ownerId, shadow FROM `z_stock_black` WHERE `id`=? LIMIT 1"); else: st = con.prepareStatement("SELECT itemId, itemName, enchant, augment, augAttr, augLvl, price, money, ownerId, shadow FROM `z_stock_items` WHERE `id`=? LIMIT 1"); st.setInt(1, sellId); rs = st.executeQuery(); if rs.next(): itemId = rs.getInt("itemId"); bItem = ItemTable.getInstance().getTemplate(itemId); if bItem == None: return self.error("Покупка шмотки","Ошибка запроса3") money = rs.getInt("money"); charId = rs.getInt("ownerId"); itemName = rs.getString("itemName"); if black == 50: enchant = rs.getInt("total"); augment = rs.getInt("count"); valute = self.getMoneyBlackCall(money); #print "" +str(count) + " > " +str(count) + " or " +str(count) + " < " +str(augment) if count > enchant or count < augment: return self.error("Покупка шмотки","Ошибка запроса4.<br>Количество не может превышать предложение или быть меньше предложения.") if count % augment != 0 and player.getObjectId() != charId: return self.error("Покупка шмотки","Ошибка запроса5.<br>Количество должно быть кратно предложению.") price = rs.getInt("price") * (count / augment); else: enchant = rs.getInt("enchant"); augment = rs.getInt("augment"); augAttr = rs.getInt("augAttr"); auhLevel = rs.getInt("augLvl"); valute = self.getMoneyCall(money); price = rs.getInt("price"); if count != 1: return self.error("Покупка шмотки","Ошибка запроса5.1") shadow = rs.getInt("shadow"); #< if price <= 0: return self.error("Покупка шмотки","Ошибка запроса5.2") if player.getObjectId() == charId: price = 0 if black == 50: count = enchant if price > 0: payment = player.getInventory().getItemByItemId(money); if payment != None and payment.getCount() >= price: quest.takeItems(money,price) else: if rs != None: rs.close() if st != None: st.close() if con != None: con.close() return self.error("Покупка шмотки","Проверьте стоимость6") #> try: upd = False if black == 50: if count == enchant or enchant - count <= 0: zabiraem=con.prepareStatement("DELETE FROM `z_stock_black` WHERE `id`=?") else: upd = True zabiraem=con.prepareStatement("UPDATE `z_stock_black` SET `total` = `total` - ? WHERE `id`=?") else: zabiraem=con.prepareStatement("DELETE FROM `z_stock_items` WHERE `id`=?") if upd: zabiraem.setInt(1, count) zabiraem.setInt(2, sellId) else: zabiraem.setInt(1, sellId) zabiraem.executeUpdate() except: if rs != None: rs.close() if st != None: st.close() if zabiraem != None: zabiraem.close() if con != None: con.close() return self.error("Покупка шмотки","Ошибка запроса7") zabiraem.close() #> if price > 0 and not self.transferPay(con,charId,0,0,0,0,0,price,money,player.getObjectId()): if rs != None: rs.close() if st != None: st.close() if con != None: con.close() return self.error("Покупка шмотки","Ошибка запроса8") #> if black == 50: lot = bItem.getName() + ", itemId " + str(itemId) + ", count " + str(count) + " [Price: " + str(money) + " " + str(price) + "]" GiveItem.insertItem(con, player.getObjectId(), itemId, count, 0, 0, 0, 0, PAYMENT_LOC, charId) else: lot = bItem.getName() + ", itemId " + str(itemId) + ", enchant " + str(enchant) + ", augment " + str(augment) + ", auhLevel " + str(auhLevel) + "[Price: " + str(money) + " " + str(price) + "]" GiveItem.insertItem(con, player.getObjectId(), itemId, count, enchant, augAttr, augment, auhLevel, PAYMENT_LOC, charId) receiver = "PlayerId: " + str(charId) + "" action,payment = "Снято","" if price > 0: action,payment = "Куплено","Стоимость: <font color="+CPRICE+">" + str(Util.formatNumber(price)) + " " + str(valute) + "</font>" alarm = L2World.getInstance().getPlayer(charId) if alarm: receiver = alarm.getFingerPrints() if black == 50: alarm.sendCritMessage("Уведомление с аукциона:" + bItem.getName() + " (+" + str(enchant) + ") купили!") else: alarm.sendCritMessage("Уведомление с аукциона: +" + str(Util.formatNumber(enchant)) + " " + bItem.getName() + " купили!") #> if price > 0: if black == 50: Log.add(lot + ": " + receiver + " -> " + player.getFingerPrints(), "item/auction/purchased_black") else: Log.add(lot + ": " + receiver + " -> " + player.getFingerPrints(), "item/auction/purchased") else: if black == 50: Log.add(lot + ":" + player.getFingerPrints(), "item/auction/delete_black") else: Log.add(lot + ":" + player.getFingerPrints(), "item/auction/delete") #> if black == 50: htmltext = "<html><body><table><tr><td width=260>Черный рынок</td><td align=right width=70><a action=\"bypass -h Quest purchase black_market\">Назад|<-</a></td></tr></table><br>" htmltext += action + "<br1> <font color="+CITEM+">" + str(Util.formatNumber(count)) + " " + bItem.getName() + "</font><br> " + payment + "</body></html>" else: htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/buy_lot_ok.htm", player) htmltext = htmltext.replace("%ACTION%", action) htmltext = htmltext.replace("%ITEM_NAME%", bItem.getName()) htmltext = htmltext.replace("%ENCHANT%", str(enchant)) htmltext = htmltext.replace("%AUGMENT%", self.getAugmentSkill(augment, auhLevel, False, player)) htmltext = htmltext.replace("%PAYMENT%", payment) htmltext = htmltext.replace("%PRICE%", htmltext) else: if rs != None: rs.close() if st != None: st.close() if con != None: con.close() return self.error("Покупка шмотки","Ни найдена или уже купили") except: pass if rs != None: rs.close() if st != None: st.close() if con != None: con.close() return htmltext elif event == "search": return HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/search.htm", player) elif event.startswith("find_ "): search = str(event.replace("find_ ", "")) type2,value,ptype=search.split("_") type2,value,ptype=str(type2),str(value),str(ptype) value_in = value value = str(value.replace(" ", "")) type2 = int(type2.replace(" ", "")) if value == "" or ptype == "": htmltext = "<html><body>Задан пустой поисковый запрос<br><br><a action=\"bypass -h Quest purchase list\">Вернуться.</a></body></html>" return htmltext if type2 != 777 and type2 >= 0: ptype = "Тип шмотки" psort = self.showSellItems(player, 1, 0, 0, 0, 0, type2, "", 0, 0) value = sorts.get(type2, "") if value == "": return self.error("Сортировка","Ошибка запроса") else: if ptype != " Название": try: intval = int(value) except: value = "qwe" if not value.isdigit(): return self.error("Сортировка","Ошибка запроса") else: value = value_in[1:] value = value[:-1] if not StringUtil.isValidStringAZ(value): return self.error("Сортировка","Строка поиска содержит запрещенные символы.") if ptype == " Id шмотки": psort = self.showSellItems(player, 1, 0, 0, intval, 0, -1, "", 0, 0) elif ptype == " Заточка": psort = self.showSellItems(player, 1, 0, 0, 0, 0, -1, "", intval, 0) elif ptype == " Название": ench = 0 name = value if value.count(" ") > 0: ench = 0 name = "" try: for k in value.split(" "): if k.isdigit(): ench = int(k) else: name += " " + k name = name[1:] except: ench = 0 name = value psort = self.showSellItems(player, 1, 0, 0, 0, 0, -1, name, ench, 0) else: psort = self.showSellItems(player, 1, 0, 0, 0, intval, -1, "", 0, 0) htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/search_results.htm", player) htmltext = htmltext.replace("%PTYPE%", ptype) htmltext = htmltext.replace("%VALUE%", value) htmltext = htmltext.replace("%RESULT%", psort) return htmltext elif event == "add": return HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add.htm", player) elif event.startswith("enchanted_"): chType = int(event.replace("enchanted_", "")) htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_enchanted.htm", player) HLIST = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_enchanted_list.htm", player) ITEMLIST = "" self.clearVars(player) if chType > 3: # каг? return self.error("Добавление шмоток","Ошибка запроса") for item in player.getInventory().getItems(): itemTemplate = item.getItem() itemId = itemTemplate.getItemId() itemType = itemTemplate.getType2() itemGrade = itemTemplate.getCrystalType() preench = item.getEnchantLevel() if self.canBeStoredEnch(item) and itemType == chType: augment = "" if chType == 0: augment = "<font color=333366>Нет аугмента</font>" if item.isAugmented() and item.getAugmentation().getSkill() != None: augment = item.getAugmentation().getSkill() augment,level = str(augment.getId()),str(augment.getLevel()) augment = self.getAugmentSkill(int(augment), int(level), False, player) itemadd = HLIST.replace("%ICON%", self.getIcon(None, itemId)) itemadd = itemadd.replace("%ID%", str(item.getObjectId())) itemadd = itemadd.replace("%ITEM_NAME%", itemTemplate.getName()) itemadd = itemadd.replace("%ENCHANT%", str(preench)) itemadd = itemadd.replace("%AUGMENT%", augment) ITEMLIST += itemadd htmltext = htmltext.replace("%LIST%", ITEMLIST) return htmltext elif event.startswith("augment_"): chType = int(event.replace("augment_", "")) htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_augmented.htm", player) HLIST = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_augmented_list.htm", player) ITEMLIST = "" self.clearVars(player) if chType != 1: # каг? return self.error("Добавление шмоток","Ошибка запроса") for item in player.getInventory().getItems(): itemTemplate = item.getItem() itemId = itemTemplate.getItemId() itemType = itemTemplate.getType2() itemGrade = itemTemplate.getCrystalType() preench = item.getEnchantLevel() if self.canBeEnchanted(item) and item.isAugmented() and item.getAugmentation().getSkill() != None and itemType == 0 and itemId not in FORBIDDEN and itemTemplate.getDuration() == -1 and itemGrade > 3 and not item.isEquipped(): augment = "" if chType == 0: augment = "<font color=333366>Нет аугмента</font>" if item.isAugmented() and item.getAugmentation().getSkill() != None: augment = item.getAugmentation().getSkill() augment,level = str(augment.getId()),str(augment.getLevel()) augment = self.getAugmentSkill(int(augment), int(level), False, player) itemadd = HLIST.replace("%ICON%", self.getIcon(None, itemId)) itemadd = itemadd.replace("%ID%", str(item.getObjectId())) itemadd = itemadd.replace("%ITEM_NAME%", itemTemplate.getName()) itemadd = itemadd.replace("%ENCHANT%", str(preench)) itemadd = itemadd.replace("%AUGMENT%", augment) ITEMLIST += itemadd htmltext = htmltext.replace("%LIST%", ITEMLIST) htmltext = htmltext.replace("%TAX_PRICE%", str(AUGMENT_TAX)) return htmltext elif event.startswith("step2_"): search = str(event.replace("step2_", "")) itemObjId,chType=search.split("_") itemObjId,chType=int(itemObjId),int(chType) item = player.getInventory().getItemByObjectId(itemObjId) cost = 0 augcost = 0 if item and self.canBeEnchanted(item) and not item.isEquipped(): itemId = item.getItemId() itemTemplate = item.getItem() itemType = itemTemplate.getType2() preench = item.getEnchantLevel() if chType == 1 and preench == 0: return self.error("Подробная инфа о шмотке","Ошибка запроса") augment = "" if chType == 2: augment = "<font color=333366>Нет аугмента</font>" augSkill = 0 if item.isAugmented() and item.getAugmentation().getSkill() != None: augcost = AUGMENT_TAX augment = item.getAugmentation().getSkill() #if chType == 2 and augment == None: #return self.error("Подробная инфа о шмотке","Ошибка запроса") augment,level = str(augment.getId()),str(augment.getLevel()) augSkill = int(augment) augment = self.getAugmentSkill(int(augment), int(level), True, player) quest.set("augment",str(augSkill)) quest.set("objId",str(itemObjId)) quest.set("enchant",str(preench)) pench = "<font color="+CENCH+">+" + str(preench) + "</font>" if chType == 50: pench = "" htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_step2.htm", player) htmltext = htmltext.replace("%ICON%", self.getIcon(None, itemId)) htmltext = htmltext.replace("%ITEM_NAME%", itemTemplate.getName()) htmltext = htmltext.replace("%ENCHANT%", pench) htmltext = htmltext.replace("%AUGMENT%", augment) if chType == 50: htmltext += "Введите количество, сколько всего вы хотите продать, но не более <font color="+CENCH+">" + str(item.getCount()) + "</font> штук:<br1>" htmltext += "<edit var=\"total\" width=70 length=\"16\"><br>" htmltext += "Введите желаемую цену за определенное количество и выберите валюту:<br>" mvars = "" if chType == 50: for i in moneys_black: if i == itemId: continue mvars+=moneys_black+";" htmltext += "<table width=300><tr><td><edit var=\"count\" width=70 length=\"16\"></td><td> штук продаете за </td><td><edit var=\"price\" width=70 length=\"16\"></td></tr>" htmltext += "<tr><td></td><td></td><td><combobox width=100 var=type list=\"" + mvars + "\"></td></tr></table><br>" htmltext += "<button value=\"Продолжить\" action=\"bypass -h Quest purchase step22_ $price _ $type _ " + str(chType) + " _ $total _ $count _ 0\" width=70 height=15 "+BUTTON_DECO+"><br>" else: mvars = "" for i in moneys: mvars+=moneys+";" htmltext = htmltext.replace("%MVARS%", mvars) htmltext = htmltext.replace("%CHTYPE%", str(chType)) tax = "" if augcost > 0: tax = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_tax_aug.htm", player) tax = tax.replace("%PRICE%", str(augcost)) else: cost = OTHER_TAX[item.getItem().getCrystalType()] if cost > 0: tax = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_tax_other.htm", player) tax = tax.replace("%PRICE%", str(cost)) htmltext = htmltext.replace("%TAX%", tax) else : htmltext = "<html><body>Ошибка!<br><a action=\"bypass -h Quest purchase step1\">Вернуться.</a></body></html>" return htmltext elif event.startswith("step22_"): search = str(event.replace("step22_ ", "")) price,mvar,chType,chCount,chPrice,top=search.split("_") price,mvar,chType,chCount,chPrice,top=str(price),str(mvar),str(chType),str(chCount),str(chPrice),str(top) if price == "" or mvar == "" or chType == "" or chCount == "" or top == "": return self.error("Шаг 2.2","Ошибка запроса1") price = str(price.replace(" ", "")) chType = str(chType.replace(" ", "")) chCount = str(chCount.replace(" ", "")) chPrice = str(chPrice.replace(" ", "")) #top = str(top.replace(" ", "")) if not price.isdigit() or not chType.isdigit() or not chCount.isdigit() or not chPrice.isdigit(): return self.error("Шаг 2.2","Ошибка запроса2") try: price = int(price) chType = int(chType) chCount = int(chCount) chPrice = int(chPrice) except: price = 0 chType = -3 chCount = 0 chPrice = 0 if price == 0 or chPrice == 0 or chCount == 0 or chType == -3: return self.error("Шаг 2.2","Ошибка запроса3") if chType == 50: mvarId = 0 for i in moneys_black: if " "+moneys_black == mvar[:-1]: mvarId = i break else: mvarId = 0 for i in moneys: if " "+moneys == mvar[:-1]: mvarId = i break if mvarId == 0: return self.error("Шаг 2.2","Ошибка запроса4" + mvar) if mvarId == 57 and price > MAX_ADENA: self.clearVars(player) return self.error("Шаг 2.2","Максимальная цена " + str(Util.formatNumber(MAX_ADENA)) + " Adena.") #Без выделения;В лучшее;Желтым;Оба top_price = 0 if top == " В лучшее": top_price = TOP_PRICE_BEST elif top == " Желтым": top_price = TOP_PRICE_YELLOW elif top == " Оба": top_price = TOP_PRICE_BOTH myItem = quest.getInt("objId") item = player.getInventory().getItemByObjectId(myItem) if item and self.canBeEnchanted(item) and not item.isEquipped(): itemId = item.getItemId() itemTemplate = item.getItem() itemType = itemTemplate.getType2() preench = item.getEnchantLevel() if chType == 1 and preench == 0: return self.error("Подробная инфа о шмотке","Ошибка запроса") cost = 0 augtax = False augment = "" if chType == 2: augment = "<font color=333366>Нет аугмента</font>" augSkill = 0 if item.isAugmented() and item.getAugmentation().getSkill() != None: augment = item.getAugmentation().getSkill() #if chType == 2 and augment == None: #return self.error("Подробная инфа о шмотке","Ошибка запроса") augment,level = str(augment.getId()),str(augment.getLevel()) augSkill = int(augment) augment = self.getAugmentSkill(int(augment), int(level), True, player) augtax = True quest.set("augment",str(augSkill)) quest.set("objId",str(myItem)) quest.set("enchant",str(preench)) pench = "<font color="+CENCH+">+" + str(preench) + "</font>" if chType == 50: pench = "" htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_step22.htm", player) htmltext = htmltext.replace("%ICON%", self.getIcon(None, itemId)) htmltext = htmltext.replace("%ITEM_NAME%", itemTemplate.getName()) htmltext = htmltext.replace("%ENCHANT%", pench) htmltext = htmltext.replace("%AUGMENT%", augment) if chType == 50: htmltext += "Количество, сколько всего вы хотите продать:<br1>" htmltext += "<font color="+CENCH+">" + str(chCount) + "</font><br>" htmltext += "Желаемая цена за определенное количество и валюта:<br>" mvars = "" if chType == 50: htmltext += "<font color="+COLOR_PRICE2+">" + str(chPrice) + " штук продаете по " + str(price) + " " + mvar[:-1] + "</font><br>" htmltext += "<button value=\"Продолжить\" action=\"bypass -h Quest purchase step3_ " + str(price) + " _ " + mvar + " _ " + str(chType) + " _ " + str(chCount) + " _ " + str(chPrice) + " _ 0\" width=70 height=15 "+BUTTON_DECO+"><br>" else: htmltext = htmltext.replace("%ICON_PRICE%", self.getIcon(None, mvarId)) htmltext = htmltext.replace("%PRICE%", str(price)) htmltext = htmltext.replace("%MONEY%", mvar[:-1]) #if top_price == 0: # htmltext += "Выделение: <font color="+COLOR_PRICE2+">" + top + "</font><br>" #else: # if quest.getQuestItemsCount(6673) >= top_price: # htmltext += "Выделение: <font color="+COLOR_PRICE2+">" + top + " (" + str(top_price) + " Atelon Монета)</font><br1>" # htmltext += "<font color=LEVEL>Оплата не возвращается!!!</font><br>" # else: # htmltext += "Выделение: <font color=ff2400>" + top + " (" + str(top_price) + " Atelon Монета)</font><br1>" if top_price == 0: htmltext = htmltext.replace("%PRICE%", str(price)) htmltext = htmltext.replace("%MVAR%", mvar) htmltext = htmltext.replace("%CHTYPE%", str(chType)) else: htmltext += "[Продолжить]" tax = "" if augtax: tax = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_tax_aug.htm", player) tax = tax.replace("%PRICE%", str(AUGMENT_TAX)) else: cost = OTHER_TAX[item.getItem().getCrystalType()] if cost > 0: tax = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_tax_other.htm", player) tax = tax.replace("%PRICE%", str(cost)) htmltext = htmltext.replace("%TAX%", tax) else : htmltext = "<html><body>Ошибка!<br><a action=\"bypass -h Quest purchase step1\">Вернуться.</a></body></html>" return htmltext elif event.startswith("step3_ "): search = str(event.replace("step3_ ", "")) price,mvar,chType,chCount,chPrice,top=search.split("_") price,mvar,chType,chCount,chPrice,top=str(price),str(mvar),str(chType),str(chCount),str(chPrice),str(top) if price == "" or mvar == "" or chType == "" or chCount == "" or top == "": self.clearVars(player) return self.error("Шаг 3","Ошибка запроса1") price = str(price.replace(" ", "")) chType = str(chType.replace(" ", "")) chCount = str(chCount.replace(" ", "")) chPrice = str(chPrice.replace(" ", "")) if not price.isdigit() or not chType.isdigit() or not chCount.isdigit() or not chPrice.isdigit(): self.clearVars(player) return self.error("Шаг 3","Ошибка запроса2") try: price = int(price) chType = int(chType) chCount = int(chCount) chPrice = int(chPrice) except: price = 0 chType = -3 chCount = 0 chPrice = 0 if price == 0 or chPrice == 0 or chCount == 0 or chType == -3: self.clearVars(player) return self.error("Шаг 3","Ошибка запроса3") mvarId = 0 valute = mvar.replace(" ", "") if chType == 50: for i in moneys_black: if " "+moneys_black == mvar[:-1] or moneys_black.replace(" ", "") == valute: mvarId = i break else: for i in moneys: if " "+moneys == mvar[:-1] or moneys.replace(" ", "") == valute: mvarId = i break if mvarId == 0: self.clearVars(player) return self.error("Шаг 3","Ошибка запроса4" + mvar) if mvarId == 57 and price > MAX_ADENA: self.clearVars(player) return self.error("Шаг 3","Максимальная цена " + str(Util.formatNumber(MAX_ADENA)) + " Adena.") top_type = 0 top_price = 0 #Без выделения;В лучшее;Желтым;Оба if top == " В лучшее": top_type = 1 top_price = TOP_PRICE_BEST elif top == " Желтым": top_type = 2 top_price = TOP_PRICE_YELLOW elif top == " Оба": top_type = 3 top_price = TOP_PRICE_BOTH if quest.getQuestItemsCount(6673) < top_price: self.clearVars(player) return self.error("Шаг 3","Стоимость выбранного выделения " + str(top_price) + " Atelon Монета.") myItem = quest.getInt("objId") item = player.getInventory().getItemByObjectId(myItem) if item: if item.isEquipped(): return self.error("Шаг 3","Ошибка запроса5") if not self.canBeEnchanted(item): return self.error("Шаг 3","Ошибка запроса6") if item.getCount() < chCount: return self.error("Шаг 3","Ошибка запроса6.1") if chPrice > chCount: return self.error("Шаг 3","Ошибка запроса6.2") myEnch = quest.getInt("enchant") myAugm = quest.getInt("augment") itemId = item.getItemId() itemTemplate = item.getItem() itemType = itemTemplate.getType2() preench = item.getEnchantLevel() if preench != myEnch: self.clearVars(player) return self.error("Шаг 3","Ошибка запроса7") augment = "нет." augEffId = 0 augSkId = 0 augSkLvl = 0 cost = 0 augtax = False if item.isAugmented() and item.getAugmentation().getSkill() != None: augment = item.getAugmentation().getSkill() augEffId = item.getAugmentation().getAugmentationId() augSkId,augSkLvl = str(augment.getId()),str(augment.getLevel()) if myAugm != int(augSkId): self.clearVars(player) return self.error("Шаг 3","Ошибка запроса8") #<payment if quest.getQuestItemsCount(AUGMENT_TAX_ID) < AUGMENT_TAX: return self.error("Шаг 3","Ошибка запроса9<br> Стоимость услуги: " + str(AUGMENT_TAX) + " Coin Of Luck.") augtax = True else: try: cost = OTHER_TAX[item.getItem().getCrystalType()] except: cost = 0 if cost > 0 and quest.getQuestItemsCount(OTHER_TAX_ID) < cost: return self.error("Шаг 3","Ошибка запроса9<br> Стоимость услуги: " + str(cost) + " Festival Adena.") #< if chType == 50: itemType = 50 #< if top_price != 0: quest.takeItems(6673, top_price) #< try: con=L2DatabaseFactory.getInstance().getConnection() if chType == 50: storeitem=con.prepareStatement("INSERT INTO `z_stock_black` (`id`,`itemId`,`itemName`,`total`,`count`,`price`,`money`,`type`,`ownerId`,`shadow`) VALUES (NULL,?,?,?,?,?,?,?,?,?);") storeitem.setInt(1,itemId) storeitem.setString(2, itemTemplate.getName()) storeitem.setInt(3, chCount) storeitem.setInt(4, chPrice) storeitem.setInt(5, price) storeitem.setInt(6, mvarId) storeitem.setInt(7, itemType) storeitem.setInt(8, player.getObjectId()) storeitem.setInt(9, 0) storeitem.executeUpdate() else: storeitem=con.prepareStatement("INSERT INTO `z_stock_items` (`id`,`itemId`,`itemName`,`enchant`,`augment`,`augAttr`,`augLvl`,`price`,`money`,`type`,`ownerId`,`shadow`,`top`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?);") storeitem.setInt(1,itemId) storeitem.setString(2, itemTemplate.getName()) storeitem.setInt(3, preench) storeitem.setInt(4, int(augSkId)) storeitem.setInt(5, int(augEffId)) storeitem.setInt(6, int(augSkLvl)) storeitem.setInt(7, price) storeitem.setInt(8, mvarId) storeitem.setInt(9, itemType) storeitem.setInt(10, player.getObjectId()) storeitem.setInt(11, 0) storeitem.setInt(12, top_type) storeitem.executeUpdate() except: if storeitem != None: storeitem.close() if con != None: con.close() self.clearVars(player) if top_price != 0: quest.giveItems(6673, top_price) return self.error("Шаг 3","Ошибка базы данных") if storeitem != None: storeitem.close() if con != None: con.close() if augtax: quest.takeItems(AUGMENT_TAX_ID, AUGMENT_TAX) if cost > 0: quest.takeItems(OTHER_TAX_ID, cost) if chType == 50: quest.takeItems(itemId, chCount) else: player.destroyItem("zzAuction", myItem, chCount, player, 1) #< self.clearVars(player) if chType == 50: lot = itemTemplate.getName() + ", itemId " + str(itemId) + ", total " + str(chCount) + ", count " + str(chPrice) + ", [Price: " + str(mvarId) + " " + str(price) + "]" Log.add(lot + ": " + player.getFingerPrints(), "item/auction/add_black") htmltext = "<html><body><table><tr><td width=260>Черный рынок</td><td align=right width=70><a action=\"bypass -h Quest purchase black_market\">Назад|<-</a></td></tr></table><br1>" htmltext += "<font color="+CITEM+">Вы выставили: " + str(Util.formatNumber(chCount)) + " " + itemTemplate.getName() + "</font><br1>" htmltext += "по <font color="+COLOR_PRICE+">" + str(Util.formatNumber(chPrice)) + " штук за " + str(Util.formatNumber(price)) + " " + self.getMoneyBlackCall(mvarId) + ".<br></body></html>" else: lot = itemTemplate.getName() + ", itemId " + str(itemId) + ", enchant " + str(preench) + ", augment " + str(augSkId) + ", auhLevel " + str(augSkLvl) + ", [Price: " + str(mvarId) + " " + str(price) + "]" Log.add(lot + ": " + player.getFingerPrints(), "item/auction/add") htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/add_ok.htm", player) htmltext = htmltext.replace("%ITEM_NAME%", itemTemplate.getName()) htmltext = htmltext.replace("%ENCHANT%", str(preench)) htmltext = htmltext.replace("%AUGMENT%", self.getAugmentSkill(int(augSkId), int(augSkLvl), False, player)) else: self.clearVars(player) return self.error("Шаг 3","Ошибка запроса99") return htmltext elif event == "office": htmltext = HtmCache.getInstance().getHtm("data/html"+self.getLang(player)+"/purchase/office.htm", player) htmltext = htmltext.replace("%PLAYER_NAME%", player.getName()) return htmltext elif event == "office_black": #data = str(strftime("%Y-%m-%d", gmtime())) #time = str(strftime("%H:%M:%S", gmtime())) htmltext = "<html><body><table><tr><td width=260>Черный рынок</td><td align=right width=70><a action=\"bypass -h Quest purchase black_market\">Назад|<-</a></td></tr></table><br1>" htmltext += "Привет, " + player.getName() + ".<br>" #htmltext += "Привет, " + player.getName() + ".<br>Сейчас " + data + " " + time + "<br>" htmltext += "<button value=\"Мои шмотки\" action=\"bypass -h Quest purchase StockShowPage_1_1_0_0_-1_1__0\" width=70 height=15 "+BUTTON_DECO+"><br>" htmltext += "</body></html>" return htmltext elif event == "black_market": htmltext = "<html><body><table width=280><tr><td>Черный рынок</td><td align=right><button value=\"Офис\" action=\"bypass -h Quest purchase office_black\" width=50 height=17 "+BUTTON_DECO+"></td><td align=right><button value=\"Добавить\" action=\"bypass -h Quest purchase add_black\" width=70 height=17 "+BUTTON_DECO+"></td><td align=right><button value=\"Аукцион\" action=\"bypass -h Quest purchase list\" width=50 height=17 "+BUTTON_DECO+"></td></tr></table><br>" htmltext += self.showSellItems(player, 1, 0, 0, 0, 0, -1, "", 0, 1) htmltext += "<br></body></html>" return htmltext elif event.startswith("add_black"): htmltext = "<html><body><table><tr><td width=260>Черный рынок</td><td align=right width=70><a action=\"bypass -h Quest purchase black_market\">Назад|<-</a></td></tr></table><br1>" htmltext += "Шаг 1.<br>Выберите товар:<br><br><table width=300>" self.clearVars(player) for item in player.getInventory().getItems(): if not item.getItemId() in moneys_black.keys():#self.getMoneyBlackCall(item.getItemId()) == "none": continue htmltext += "<tr><td><img src=\"" + self.getIcon(None, item.getItemId()) + "\" width=32 height=32><br></td><td><a action=\"bypass -h Quest purchase step2_" + str(item.getObjectId()) +"_50\">" + item.getItem().getName() + " (" + str(Util.formatNumber(item.getCount())) + ")</a></td></tr>" htmltext += "</table><br></body></html>" return htmltext else: self.clearVars(player) return self.error("404","Ошибка запроса56") return def onFirstTalk (self,npc,player): st = player.getQuestState(qn) if not st : st = self.newQuestState(player) return self.onTalk(npc,player) def onTalk (self,npc,player): st = player.getQuestState(qn) if not st : st = self.newQuestState(player) npcId = npc.getNpcId() if npcId == MARKET: htmltext = "<html><body>" + str(self.getMainMenu(player)) + "<br>" #if TOP_ITEMS == 1: # htmltext += self.getTopItems(player) htmltext += self.showSellItems(player, 1, 0, 0, 0, 0, -1, "", 0, 0) htmltext += "<br></body></html>" return htmltext return def getLang (self,player): if player.getChatLanguage() == 1: return "_en" return "" QUEST = Quest(-1,qn,"custom") QUEST.addFirstTalkId(MARKET) QUEST.addStartNpc(MARKET) QUEST.addTalkId(MARKET) Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
lacosta 206 Опубликовано 18 ноября, 2016 ну если не ошибаюсь то вот это оно if item.getItem().getCrystalType() < 4 and item.getItemId() != 6660: Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Dextron 2 Опубликовано 18 ноября, 2016 ну если не ошибаюсь то вот это оно if item.getItem().getCrystalType() < 4 and item.getItemId() != 6660: Сожалею, но нет # if item.getItem().getCrystalType() < 4 and item.getItemId() != 6660: # return Falseвот так вот сделал. оружие вообще добавить теперь нельзя. броня и бижа в списке не появились Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Norman 78 Опубликовано 18 ноября, 2016 смотрите в сторону проверок плана EnchantLevel Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Dextron 2 Опубликовано 18 ноября, 2016 смотрите в сторону проверок плана EnchantLevel if item.getEnchantLevel() <= 0: и дальше повторяется preench = item.getEnchantLevel() что тут смотреть? Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Dextron 2 Опубликовано 18 ноября, 2016 if item.getEnchantLevel() <= 0: и дальше повторяется preench = item.getEnchantLevel() что тут смотреть? //closed. # if item.getEnchantLevel() <= 0: Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Dextron 2 Опубликовано 18 ноября, 2016 //closed. # if item.getEnchantLevel() <= 0: Вещи в списке появились, но добавить их нельзя. Выручайте) Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
gvb 666 Опубликовано 18 ноября, 2016 Вещи в списке появились, но добавить их нельзя. Выручайте) Там не одна проверка, помню вырезал. Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты