Перейти к содержанию
Авторизация  
Decryptor

Кастом Нпц (питон)

Рекомендуемые сообщения

Итак...Все добавил правильно, настроил...но при при

 

импорте квеста критует ошибку в логе...не погу понять

 

что за фишка)

 

 

Код нпц №1

# -*- coding: utf-8 -*-
import sys
from javolution.text import TextBuilder
from net.sf.l2j import L2DatabaseFactory
from net.sf.l2j.gameserver.datatables import 

AugmentationData
from net.sf.l2j.gameserver.datatables import 

ItemTable
from net.sf.l2j.gameserver.datatables import 

SkillTable
from net.sf.l2j.gameserver.model import 

L2Augmentation
from net.sf.l2j.gameserver.model import 

L2ItemInstance
from net.sf.l2j.gameserver.model import L2Skill
from net.sf.l2j.gameserver.model import L2World
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import 

QuestState
from net.sf.l2j.gameserver.model.quest.jython import 

QuestJython as JQuest
from net.sf.l2j.gameserver.network import 

SystemMessageId
from net.sf.l2j.gameserver.network.serverpackets 

import ExMailArrived
from net.sf.l2j.gameserver.network.serverpackets 

import ItemList
from net.sf.l2j.gameserver.network.serverpackets 

import SystemMessage
from net.sf.l2j.gameserver.templates import L2Item
from net.sf.l2j.util import Rnd
from net.sf.l2j.gameserver.util import Util
from time import gmtime, strftime

qn = "purchase"

MARKET = 80007
PAGE_LIMIT = 10
SORT_LIMIT = 8

MAX_ADENA = 2147000000

FORBIDDEN = 

[6611,6612,6613,6614,6615,6616,6617,6618,6619,6620,66

21]

#
CENCH = "CCCC33"
CPRICE = "669966"
CITEM = "993366"
CAUG1 = "333366"
CAUG2 = "006699"

moneys = {57: "Adena", 4037: "Coin of Luck", 22227: 

"Farm Coin", 22225: "PvP Coin", 22226: "Event Coin"}
sorts = {0: "Оружие", 1: "Броня", 2: "Бижутерия"}

class Quest (JQuest) :

def __init__(self,id,name,descr): 

JQuest.__init__(self,id,name,descr)

def init_LoadGlobalData(self) :
  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):
  icon = "Icon.NOIMAGE"
  ext = False
  try:
 if con == None:
   ext = True


con=L2DatabaseFactory.getInstance().getConnection()
 st = con.prepareStatement("SELECT itemIcon FROM 

`z_market_icons` WHERE `itemId`=? LIMIT 1");
 st.setInt(1, iid);
 rs = st.executeQuery();
 if rs.next():
   icon = rs.getString("itemIcon")
  except:
 pass
  finally:
 self.closeRes(rs)
 self.closeStat(st)
 if ext:
   self.closeCon(con)
  return icon

def getMoneyCall(self,money):
  return moneys.get(money, str("Adena"))

def getSellerName(self,con,charId):
  name = "???"
  try:
 st = con.prepareStatement("SELECT char_name FROM 

`characters` WHERE `Obj_Id`=? LIMIT 1");
 st.setInt(1, charId);
 rs = st.executeQuery();
 if rs.next():
   name = rs.getString("char_name")
  except:
 pass
  finally:
 self.closeRes(rs)
 self.closeStat(st)
  return name

def getAugmentSkill(self, aid, lvl):
  augment = SkillTable.getInstance().getInfo(aid, 1)
  if augment == None:
 return "" 
  augName = augment.getName();
  stype = "Шанс";
  if augment.isActive():
 stype = "Актив"
  elif augment.isPassive():
 stype = "Пассив"
  augName = augName.replace("Item Skill: ", "");  
  return "<font color="+CAUG1+">Аугмент:</font> 

<font color="+CAUG2+">" + augName + " (" + stype + 

":" + str(lvl) + "lvl)</font>";

def getPageCount(self, con, me, itemId, augment, 

type2, charId):
  rowCount = 0
  pages = 0
  try:


con=L2DatabaseFactory.getInstance().getConnection()
 if 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 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
  finally:
 self.closeRes(rs)
 self.closeStat(st)
  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 

transferPay(self,con,charId,itemId,enchant,augment,au

hLevel,price,money):
  item = ItemTable.getInstance().getTemplate(itemId)
  if item == None:
 return False
  data = str(strftime("%Y-%m-%d", gmtime()))
  time = str(strftime("%H:%M:%S", gmtime()))
  text = TextBuilder()
  text.append("Итем: <font color=FF3399>" + 

item.getName() + " +" + str(enchant) + " " + 

self.getAugmentSkill(augment, auhLevel) 

+"</font><br1> был успешно продан.<br1>")
  text.append("Благодарим за сотрудничество.")
  try:
 sName = self.getSellerName(con,charId)
 st = con.prepareStatement("INSERT INTO 

`z_post_pos` 

(`id`,`tema`,`text`,`from`,`to`,`type`,`date`,`time`,

`itemName`,`itemId`,`itemCount`,`itemEnch`,`augData`,

`augSkill`,`augLvl`) VALUES 

(NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
 st.setString(1, "Шмотка продана")
 st.setString(2, text.toString())
 st.setString(3, "~zzAuction#.")
 st.setString(4, sName)
 st.setInt(5, 0)
 st.setString(6, data)
 st.setString(7, time)
 st.setString(8, item.getName())
 st.setInt(9, money)
 st.setInt(10, price)
 st.setInt(11, 0)
 st.setInt(12, 0)
 st.setInt(13, 0)
 st.setInt(14, 0)
 st.execute()
 alarm = L2World.getInstance().getPlayer(sName)
 if alarm:
   alarm.sendMessage("Уведомление с аукциона: 

проверь почту")
   alarm.sendPacket(ExMailArrived())
 return True
  except: 
 return False
  finally:
 text.clear()  
 self.closeStat(st)
  return False

def showSellItems(self,player, page, me, last, 

itemId, augment, type2):
  text = TextBuilder("<br><table width=300><tr><td 

width=36></td><td width=264>")
  if last == 1:
 text.append("Последние " + str(PAGE_LIMIT) + 

":</td></tr>")
  else:
 text.append("Страница " + str(page) + 

":</td></tr>")
  limit1 = (page-1) * PAGE_LIMIT
  limit2 = PAGE_LIMIT
  con = None
  try:


con=L2DatabaseFactory.getInstance().getConnection()
 if type2 >= 0:  
   st=con.prepareStatement("SELECT id, itemId, 

enchant, augment, augLvl, price, money, ownerId, 

shadow 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 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 FROM `z_stock_items` WHERE `augment` = ? ORDER 

BY `id` DESC LIMIT ?, ?")
   st.setInt(1, augment)
   st.setInt(2, limit1)
   st.setInt(3, limit2)
 elif me == 1:
   st=con.prepareStatement("SELECT id, itemId, 

enchant, augment, augLvl, price, money, ownerId, 

shadow 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 FROM `z_stock_items` ORDER BY `id` DESC LIMIT 

?, ?")
   st.setInt(1, limit1)
   st.setInt(2, limit2)
 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="+CPRICE+">" + 

str(Util.formatAdena(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=666699>" + 

str(Util.formatAdena(rs.getInt("price"))) + " " + 

self.getMoneyCall(rs.getInt("money")) + 

";</font></td><td align=right><button value=\"X\" 

action=\"bypass -h Quest purchase StockBuyItem_" + 

str(sId) + "\" width=25 height=15 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td></tr></table><br1>"
   text.append("<tr><td><img src=\"Icon." + 

brokeItem.getIcon() + "\" width=32 

height=32></td><td><a action=\"bypass -h Quest 

purchase StockShowItem_" + str(sId) + "\"> <font 

color="+CITEM+">" + brokeItem.getName() + 

"</font></a><font color="+CENCH+">+" + 

str(rs.getInt("enchant")) + "</font> <br1> " +priceB+ 

" <br1>" + self.getAugmentSkill(rs.getInt("augment"), 

rs.getInt("augLvl")) + "</td></tr>"); 
  except: 
 pass
  finally:
 self.closeRes(rs)
 self.closeStat(st)
  text.append("</table><br>");
  if last == 1:
 text.append("<br>");
  else:		
 pages = int(self.getPageCount(con, me, itemId, 

augment, type2,player.getObjectId()))
 if pages >= 2:


text.append(self.sortPages(page,pages,me,itemId,augme

nt,type2))
  self.closeCon(con)
  htmltext = text.toString()
  text.clear()
  return htmltext

def 

sortPages(self,page,pages,me,itemId,augment,type2):
  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) + "\"> ... </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(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) + "\"> ... </a></td>")
   break
 step+=1
  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):
  quest = player.getQuestState(qn)
  if event == "list":
 htmltext = "<html><body><table 

width=280><tr><td>Аукцион</td><td align=right><button 

value=\"Офис\" action=\"bypass -h Quest purchase 

office\" width=70 height=17 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td><td align=right><button 

value=\"Добавить\" action=\"bypass -h Quest purchase 

add\" width=70 height=17 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td><td align=right><button 

value=\"Поиск\" action=\"bypass -h Quest purchase 

search\" width=40 height=17 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td></tr></table><br>"
 htmltext += self.showSellItems(player, 1, 0, 0, 

0, 0, -1)
 htmltext += "<br></body></html>"
 return htmltext
  elif event.startswith("StockShowPage_"):
 search = str(event.replace("StockShowPage_", 

""))
 page,me,itemId,augment,type2=search.split("_")
 if page == "" or me == "" or augment == "" or 

itemId == "" or type2 == "":
   return self.error("Листание страниц","Ошибка 

запроса")


page,me,itemId,augment,type2=int(page),int(me),int(it

emId),int(augment),int(type2)
 if me == 1:
   stype = "Мои шмотки"
 htmltext = "<html><body><table 

width=280><tr><td>Аукцион</td><td align=right><button 

value=\"Офис\" action=\"bypass -h Quest purchase 

office\" width=70 height=17 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td><td align=right><button 

value=\"Добавить\" action=\"bypass -h Quest purchase 

add\" width=70 height=17 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td><td align=right><button 

value=\"Поиск\" action=\"bypass -h Quest purchase 

search\" width=40 height=17 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td></tr></table><br><br1>"
 htmltext += self.showSellItems(player, page, me, 

0, itemId, augment, type2)
 htmltext += "<br></body></html>"
 return htmltext
  elif event.startswith("StockShowItem_"):
 sellId = event.replace("StockShowItem_", "")
 if sellId == "":
   return self.error("Просмотр шмотки","Ошибка 

запроса")
 sellId=int(sellId)
 text = TextBuilder("<html><body>")
 try:
   con = 

L2DatabaseFactory.getInstance().getConnection();
   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("Просмотр 

шмотки","Ошибка запроса")
	 text.append("<font color=666666>ID шмотки: " 

+ str(itemId) + "</font> <button value=\"Найти еще\" 

action=\"bypass -h Quest purchase find_ 777 _ " + 

str(itemId) + " _ Id шмотки\" width=70 height=15 

back=\"sek.cbui94\" fore=\"sek.cbui92\">")
	 enchant = rs.getInt("enchant");
	 augment = rs.getInt("augment");
	 auhLevel = rs.getInt("augLvl");
	 price = rs.getInt("price");
	 money = rs.getInt("money");
	 charId = rs.getInt("ownerId");
	 shadow = rs.getInt("shadow");
	 valute = self.getMoneyCall(money);
	#<
	 text.append("<table width=300><tr><td><img 

src=\"" + brokeItem.getIcon() + "\" width=32 

height=32></td><td><font color=LEVEL>" + 

brokeItem.getName() + " +" + str(enchant) + 

"</font><br></td></tr></table><br><br>")
	 text.append("Продавец: " + 

self.getSellerName(con,charId) + "<br><br>")
	 text.append(self.getAugmentSkill(augment, 

auhLevel) + "<br1>")
	 if augment > 0:
	   text.append("<button value=\"Найти еще\" 

action=\"bypass -h Quest purchase find_ 777 _ " + 

str(augment) + " _ Id аугмента\" width=70 height=15 

back=\"sek.cbui94\" fore=\"sek.cbui92\"><br><br>")
	 if player.getObjectId() == charId:
	   text.append("<button value=\"Забрать\" 

action=\"bypass -h Quest purchase StockBuyItem_" + 

str(sellId) + "\" width=60 height=15 

back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>")
	 else:
	   payment = 

player.getInventory().getItemByItemId(money);
	   fprice = str(Util.formatAdena(price))
	   if payment != None and payment.getCount() 

>= price:
		 text.append("<font 

color=33CC00>Стоимость: " + fprice+ " " + str(valute) 

+ "</font><br>");
		 text.append("<button value=\"Купить\" 

action=\"bypass -h Quest purchase StockBuyItem_" + 

str(sellId) + "\" width=60 height=15 

back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>")
	   else:
		 text.append("<font 

color=CC3333>Стоимость: " + fprice + " " + 

str(valute) + "</font><br>");
		 text.append("<font 

color=999999>[Купить]</font>");
   else:
	 return self.error("Просмотр шмотки","Ни 

найдена или уже купили")
 except:
   pass
 finally:
   self.closeRes(rs)
   self.closeStat(st)
   self.closeCon(con)
 text.append("<br><br><a action=\"bypass -h Quest 

purchase list\">Вернуться</a><br>");
 text.append("</body></html>");	
 htmltext = text.toString()
 text.clear()
 return htmltext
  elif event.startswith("StockBuyItem_"):
 sellId = event.replace("StockBuyItem_", "")
 if sellId == "":
   return self.error("Покупка шмотки","Ошибка 

запроса")
 sellId=int(sellId)
 try:
   con = 

L2DatabaseFactory.getInstance().getConnection();
   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("Покупка шмотки","Ошибка 

запроса")
	 itemName = rs.getString("itemName");
	 enchant = rs.getInt("enchant");
	 augment = rs.getInt("augment");
	 augAttr = rs.getInt("augAttr");
	 auhLevel = rs.getInt("augLvl");
	 price = rs.getInt("price");
	 money = rs.getInt("money");
	 charId = rs.getInt("ownerId");
	 shadow = rs.getInt("shadow");
	 valute = self.getMoneyCall(money);
	#<  
	 if player.getObjectId() == charId:
	   price = 0
	 if price > 0:
	   payment = 

player.getInventory().getItemByItemId(money);
	   if payment != None and payment.getCount() 

>= price:
		 quest.takeItems(money,price)
	   else:
		 return self.error("Покупка 

шмотки","Проверьте стоимость")
	#>
	 try:
	   zabiraem=con.prepareStatement("DELETE FROM 

`z_stock_items` WHERE `id`=?")
	   zabiraem.setInt(1, sellId)
	   zabiraem.executeUpdate()
	 except:
	   return self.error("Покупка шмотки","Ошибка 

запроса")
	 finally:
	   self.closeStat(zabiraem)
	#>
	 if price > 0 and not 

self.transferPay(con,charId,itemId,enchant,augment,au

hLevel,price,money):
	   return self.error("Покупка шмотки","Ошибка 

запроса")
	#> 
	 item = 

player.getInventory().addItem("zzAuction", itemId, 1, 

player, player.getTarget())
	 if enchant != 0:
	   item.setEnchantLevel(enchant)
	 if augAttr != 0:
	   item.setAugmentation(L2Augmentation(item, 

augAttr, augment, auhLevel, True))
	 smsg = 

SystemMessage(SystemMessageId.EARNED_S2_S1_S)
	 smsg.addItemName(itemId)
	 smsg.addNumber(1)
	 player.sendPacket(smsg)
	 player.sendPacket(ItemList(player, True))
	 action,payment = "Снято","" 
	 if price > 0:
	   action,payment = "Куплено","Стоимость: 

<font color="+CPRICE+">" + 

str(Util.formatAdena(price)) + " " + str(valute) + 

"</font>"
	   alarm = 

L2World.getInstance().getPlayer(self.getSellerName(co

n,charId))
	   if alarm:
		 alarm.sendMessage("Уведомление с 

аукциона:" + bItem.getName() + " (+" + str(enchant) + 

") купили!")
	 htmltext = "<html><body><table><tr><td 

width=260>Аукцион</td><td align=right width=70><a 

action=\"bypass -h Quest purchase 

list\">Назад|<-</a></td></tr></table><br>"
	 htmltext += action + "<br1> <font 

color="+CITEM+">" + bItem.getName() + "</font><font 

color="+CENCH+"> +" + str(enchant) + "</font><br> " + 

self.getAugmentSkill(augment, auhLevel) + " <br> " + 

payment + "</body></html>"
   else:
	 return self.error("Покупка шмотки","Ни 

найдена или уже купили")
 except:
   pass
 finally:
   self.closeRes(rs)
   self.closeStat(st)
   self.closeCon(con)
 return htmltext
  elif event == "search":
 htmltext = "<html><body><table><tr><td 

width=260>Аукцион</td><td align=right width=70><a 

action=\"bypass -h Quest purchase 

list\">Назад|<-</a></td></tr></table><br>"
 htmltext += "<table width=260><tr>"
 step = 0
 for i in sorts:
   htmltext += "<td><button value=\"" + sorts[i] 

+ "\" action=\"bypass -h Quest purchase find_ " + 

str(i) + " _ no _ no\" width=50 height=21 

back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
   step+=1
   if step == 4:
	 step = 0
	 htmltext += "</tr><tr>"
 htmltext += "</tr></table><br><table width=220 

border=0><tr><td align=right><edit var=\"value\" 

width=150 length=\"16\"></td><td 

align=right><combobox width=71 var=keyword list=\"Id 

шмотки;Id аугмента\"></td><td><button value=\"Поиск\" 

action=\"bypass -h Quest purchase find_ 777 _ $value 

_ $keyword\" width=50 height=21 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"></td></tr></table>"
 htmltext += "<br></body></html>"
 return htmltext
  elif event.startswith("find_ "):
 search = str(event.replace("find_ ", ""))
 type2,value,ptype=search.split("_")


type2,value,ptype=str(type2),str(value),str(ptype)
 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)
   value = sorts.get(type2, "")
   if value == "":
	 return self.error("Сортировка","Ошибка 

запроса")
 else:
   if not value.isdigit():
	 return self.error("Сортировка","Ошибка 

запроса")
   if ptype == " Id шмотки":
	 psort = self.showSellItems(player, 1, 0, 0, 

int(value), 0, -1)
   else:
	 psort = self.showSellItems(player, 1, 0, 0, 

0, int(value), -1)
 htmltext = "<html><body><table><tr><td 

width=260>Аукцион</td><td align=right width=70><a 

action=\"bypass -h Quest purchase 

search\">Назад|<-</a></td></tr></table><br>"
 htmltext += "<table><tr><td width=260><font 

color=336699>Поиск по:</font> <font 

color=CC66CC>"+ptype+":</font><font 

color=CC33CC>"+value+"</font></td><td align=right 

width=70></td></tr></table><br1>"
 htmltext += psort
 htmltext += "<br><a action=\"bypass -h Quest 

purchase list\">Вернуться</a><br></body></html>"
 return htmltext
  elif event == "add":
 htmltext = "<html><body><table><tr><td 

width=260>Аукцион</td><td align=right width=70><a 

action=\"bypass -h Quest purchase 

list\">Назад|<-</a></td></tr></table><br1>"
 htmltext += "<font color=LEVEL>Что хотите 

выставить на продажу?</font><br1>"
 htmltext += "Оружие:<br1>"
 htmltext += "<table width=240><tr><td><button 

value=\"Заточенное\" action=\"bypass -h Quest 

purchase enchanted_0\" width=90 height=15 

back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
 htmltext += "<td><button 

value=\"Аугментированное.\" action=\"bypass -h Quest 

purchase augment_1\" width=90 height=15 

back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
 htmltext += "</tr></table><br>--------<br1>"
 htmltext += "<button value=\"Броня (+)\" 

action=\"bypass -h Quest purchase enchanted_1\" 

width=90 height=15 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"><br>"
 htmltext += "<button value=\"Бижутерия (+)\" 

action=\"bypass -h Quest purchase enchanted_2\" 

width=90 height=15 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"><br>"	
 htmltext += "</body></html>"
 return htmltext
  elif event.startswith("enchanted_"):
 chType = int(event.replace("enchanted_", ""))
 htmltext = "<html><body><table><tr><td 

width=260>Аукцион</td><td align=right width=70><a 

action=\"bypass -h Quest purchase 

add\">Назад|<-</a></td></tr></table><br1>"
 htmltext += "Шаг 1.<br>Выберите 

шмотку:<br><br><table width=300>"
 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 item.canBeEnchanted() and preench > 0 and 

itemType == chType 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().getAugmentSkill() != None:
	   augment = 

item.getAugmentation().getAugmentSkill()
	   augment,level = 

str(augment.getId()),str(augment.getLevel())
	   augment = 

self.getAugmentSkill(int(augment), int(level))
	 htmltext += "<tr><td><img 

src=\"Icon."+itemTemplate.getIcon()+"\" width=32 

height=32><br></td><td><a action=\"bypass -h Quest 

purchase step2_" + str(item.getObjectId()) +"_1\">" + 

itemTemplate.getName() + "</a> <font 

color="+CENCH+">+" + str(preench) + "</font><br1>" + 

augment + "</td></tr>"
 htmltext += "</table><br></body></html>"
 return htmltext
  elif event.startswith("augment_"):
 chType = int(event.replace("augment_", ""))
 htmltext = "<html><body><table><tr><td 

width=260>Аукцион</td><td align=right width=70><a 

action=\"bypass -h Quest purchase 

add\">Назад|<-</a></td></tr></table><br1>"
 htmltext += "Шаг 1.<br>Выберите 

шмотку:<br><br><table width=300>"
 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 item.canBeEnchanted() and 

item.isAugmented() and 

item.getAugmentation().getAugmentSkill() != 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().getAugmentSkill() != None:
	   augment = 

item.getAugmentation().getAugmentSkill()
	   augment,level = 

str(augment.getId()),str(augment.getLevel())
	   augment = 

self.getAugmentSkill(int(augment), int(level))
	 htmltext += "<tr><td><img 

src=\""+itemTemplate.getIcon()+"\" width=32 

height=32><br></td><td><a action=\"bypass -h Quest 

purchase step2_" + str(item.getObjectId()) +"_2\">" + 

itemTemplate.getName() + "</a> <font 

color="+CENCH+">+" + str(preench) + "</font><br1>" + 

augment + "</td></tr>"
 htmltext += "</table><br></body></html>"
 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)
 if item.canBeEnchanted() and 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().getAugmentSkill() != None:
	 augment = 

item.getAugmentation().getAugmentSkill()
	#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))
   quest.set("augment",str(augSkill))
   quest.set("objId",str(itemObjId))
   quest.set("enchant",str(preench)) 
   htmltext =  "<html><body>Шаг 

2.<br>Подтверждаете?<br>"
   htmltext += "<table width=300><tr><td><img 

src=\""+itemTemplate.getIcon()+"\" width=32 

height=32></td><td><font color="+CITEM+">" + 

itemTemplate.getName() + "</font><font 

color="+CENCH+">+" + str(preench) + "</font><br>"+ 

augment + "</td></tr></table><br><br>"
   htmltext += "Введите желаемую цену и выберите 

валюту:<br>"
   mvars = "Adena;"
   for i in moneys:
	 mvars+=moneys[i]+";"
   htmltext += "<table width=300><tr><td><edit 

var=\"price\" width=70 

length=\"16\"></td><td><combobox width=100 var=type 

list=\"" + mvars + "\"></td></tr></table><br>"
   htmltext += "<button value=\"Продолжить\" 

action=\"bypass -h Quest purchase step3_ $price _ 

$type\" width=70 height=15 back=\"sek.cbui94\" 

fore=\"sek.cbui92\"><br>"
   htmltext += "<br><a action=\"bypass -h Quest 

purchase add\">Вернуться.</a></body></html>"
 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=search.split("_")
 price,mvar=str(price),str(mvar)
 price = str(price.replace(" ", ""))
 if price == "" or mvar == "":
   return self.error("Шаг 3","Ошибка запроса")
 if not price.isdigit():
   return self.error("Шаг 3","Ошибка запроса")
 price = int(price)
 if price == 0:
   return self.error("Шаг 3","Ошибка запроса")
 mvarId = 57
 for i in moneys:
   if " "+moneys[i] == mvar:
	 mvarId = i
	 break
 if mvarId == 57 and price > MAX_ADENA:
   self.clearVars(player)
   return self.error("Шаг 3","Максимальная цена " 

+ str(Util.formatAdena(MAX_ADENA)) + " Adena.")
 myItem = quest.getInt("objId")
 item = 

player.getInventory().getItemByObjectId(myItem)
 if item:
   if item.isEquipped():
	 return self.error("Шаг 3","Ошибка запроса")
   if not item.canBeEnchanted():
	 return self.error("Шаг 3","Ошибка запроса")
   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","Ошибка запроса")
   augment = "нет." 
   augEffId = 0
   augSkId = 0
   augSkLvl = 0
   if item.isAugmented() and 

item.getAugmentation().getAugmentSkill() != None:
	 augment = 

item.getAugmentation().getAugmentSkill()
	 augEffId = 

item.getAugmentation().getAugmentationId()
	 augSkId,augSkLvl = 

str(augment.getId()),str(augment.getLevel())
	 if myAugm != int(augSkId):
	   self.clearVars(player)
	   return self.error("Шаг 3","Ошибка 

запроса")
  #<
   try:  


con2=L2DatabaseFactory.getInstance().getConnection()
	 storeitem=con2.prepareStatement("INSERT INTO 

`z_stock_items` 

(`id`,`itemId`,`itemName`,`enchant`,`augment`,`augAtt

r`,`augLvl`,`price`,`money`,`type`,`ownerId`,`shadow`

) 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.executeUpdate()
   except:
	 self.clearVars(player)
	 return self.error("Шаг 3","Ошибка базы 

данных")
   finally:
	 self.closeStat(storeitem)
	 self.closeCon(con2)
   player.destroyItem("zzAuction",myItem, 1, 

player, 1)
  #<
   self.clearVars(player)
   htmltext = "<html><body><table><tr><td 

width=260>Аукцион</td><td align=right width=70><a 

action=\"bypass -h Quest purchase 

add\">Назад|<-</a></td></tr></table><br1>"
   htmltext += "<font color="+CITEM+">" + 

itemTemplate.getName() + "</font><font 

color="+CENCH+">+" + str(preench) + "</font><br1> " + 

self.getAugmentSkill(int(augSkId), int(augSkLvl)) + " 

<br1>выставлена на продажу!</body></html>"
 else:
   self.clearVars(player)
   return self.error("Шаг 3","Ошибка запроса")
 return htmltext
  elif event == "office":
#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 

list\">Назад|<-</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\" width=70 height=15 

back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
 htmltext += "</body></html>"
 return htmltext
  return

def onTalk (self,npc,player):
  st = player.getQuestState(qn)
  npcId = npc.getNpcId()
  if npcId == MARKET:
 return "<html><body>На аукционе вы можете 

торговать заточенными и аугментированными 

шмотками.<br><a action=\"bypass -h Quest purchase 

list\">Просмотр</a><br><br>Если шмотку купили, оплата 

придет на почту.</body></html>"
  return	

QUEST	   = Quest(-1,qn,"custom")
CREATED	 = State('Start', QUEST)

QUEST.setInitialState(CREATED)

QUEST.addStartNpc(MARKET)
QUEST.addTalkId(MARKET)

 

 

Крит №1

 

 

Error on: бла бла

 

бла\data\scripts\custom\purchase\__init__.py.error.lo

 

g

Line: -1 - Column: -1

 

Traceback (innermost last):

(no code object) at line 0

SyntaxError: ('invalid syntax', ('__init__.py', 80,

 

4, ' finally:'))

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Нпц нумеро 2

 

 

 

# -*- coding: utf-8 -*-

import sys

from net.sf.l2j import Config

from net.sf.l2j import L2DatabaseFactory

from net.sf.l2j.gameserver.datatables import

 

AugmentationData

from net.sf.l2j.gameserver.datatables import

 

ItemTable

from net.sf.l2j.gameserver.datatables import

 

SkillTable

from net.sf.l2j.gameserver.idfactory import IdFactory

from net.sf.l2j.gameserver.model import

 

L2Augmentation

from net.sf.l2j.gameserver.model import L2World

from net.sf.l2j.gameserver.model import

 

L2ItemInstance

from net.sf.l2j.gameserver.model.quest import State

from net.sf.l2j.gameserver.model.quest import

 

QuestState

from net.sf.l2j.gameserver.model.quest.jython import

 

QuestJython as JQuest

from net.sf.l2j.gameserver.network import

 

SystemMessageId

from net.sf.l2j.gameserver.network.serverpackets

 

import StatusUpdate

from net.sf.l2j.gameserver.network.serverpackets

 

import ItemList

from net.sf.l2j.gameserver.network.serverpackets

 

import SystemMessage

from net.sf.l2j.gameserver.network.serverpackets

 

import ExShowQuestMark

from net.sf.l2j.gameserver.network.serverpackets

 

import ExMailArrived

from net.sf.l2j.gameserver.network.serverpackets

 

import PlaySound

from net.sf.l2j.gameserver.templates import

 

L2EtcItemType

from net.sf.l2j.gameserver.templates import L2Item

from time import gmtime, strftime

 

qn = "q8782_ExpressPost"

 

#нпц

POSTMAN = 800007

 

#id марки

POSTMARK = 9400

 

#цены

PISMO = 15 # отправка письма

POSILKA = 30 # отправка посылки

 

#показ сообщений на страницу

LIMIT = 25

#показ шмота на страницу

LIMITT = 15

 

RAZDELY = [1,2]#,3,4,5,6,7,8,9,10,11,12,13,14,15]

#отображение названий разделов

trans = {1: "Оружие", 2: "Броня"}#, 3: "Ресурсы", 4:

 

"Рецепты", 5: "Книжки", 6: "Патроны", 7: "7 печатей",

 

8: "Скроллы", 9: "Кристаллы", 10: "Зелья", 11:

 

"Тату", 12: "Стрелы", 13: "СА кри", 14: "Удочки", 15:

 

"Квестовые", 16: "Life Stone"}

# sorts не трогать!!

sorts = {1: "Weapon", 2: "Armor"}#, 3: "Resource", 4:

 

"Recipe", 5: "Spellbook", 6: "Soulshot", 7:

 

"AncientAdena", 8: "Scroll", 9: "Crystal", 10:

 

"Potion", 11: "Tatoo", 12: "Arrow", 13:

 

"SoulCrystal", 14: "Rod", 15: "QuestItems", 16:

 

"LifeStone"}

#

CENCH = "CCCC33"

CPRICE = "669966"

CITEM = "993366"

CAUG1 = "333366"

CAUG2 = "006699"

 

class Quest (JQuest) :

 

def __init__(self,id,name,descr):

 

JQuest.__init__(self,id,name,descr)

 

def init_LoadGlobalData(self) :

print "q8782_ExpressPost (Comercial) loaded."

return

 

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 getAugmentSkill(self, aid, lvl):

augment = SkillTable.getInstance().getInfo(aid, 1)

if augment == None:

return ""

augName = augment.getName();

stype = "Шанс";

if augment.isActive():

stype = "Актив"

elif augment.isPassive():

stype = "Пассив"

augName = augName.replace("Item Skill: ", "");

return "<font color="+CAUG1+">Аугмент:</font>

 

<font color="+CAUG2+">" + augName + " (" + stype +

 

":" + str(lvl) + "lvl)</font>";

 

def onAdvEvent (self,event,npc,player):

st = player.getQuestState(qn)

if event == "pisma":

st.unset("stranic")

htmltext = "pismo.htm"

return htmltext

elif event == "posilki":

st.unset("sellitem")

st.unset("lcount")

htmltext = "posilka.htm"

return htmltext

elif event == "home":

htmltext = "<html><body>Почтальон:<br>"

htmltext += "<table width=270><tr><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inn\">Письма.</a><br><a action=\"bypass -h Quest

 

q8782_ExpressPost posilki\">Посылки.</a><br></td>"

htmltext += "</tr></table><br>"

htmltext += "Стоимость отправки письма: " +

 

str(PISMO) + " Silver Shillien.<br1>"

htmltext += "Стоимость отправки посылки: " +

 

str(POSILKA) + " Silver Shillien.<br>"

htmltext += "</body></html>"

return htmltext

elif event == "inn":

name = str(st.getPlayer().getName())

self.startQuestTimer("innn",500,None,player)

htmltext = "<html><body>Загрузка

 

"+name+"...<br1><img src=\"sek.cbui176\" width=10

 

height=3></body></html>"

return htmltext

elif event == "innn":

name = str(st.getPlayer().getName())

self.startQuestTimer("innnn",500,None,player)

htmltext = "<html><body>Загрузка

 

"+name+"...<br1><img src=\"sek.cbui176\" width=60

 

height=3></body></html>"

return htmltext

elif event == "innnn":

name = str(st.getPlayer().getName())

self.startQuestTimer("innnnn",500,None,player)

htmltext = "<html><body>Загрузка

 

"+name+"...<br1><img src=\"sek.cbui176\" width=110

 

height=3></body></html>"

return htmltext

elif event == "innnnn":

name = str(st.getPlayer().getName())

self.startQuestTimer("in",300,None,player)

htmltext = "<html><body>Загрузка

 

"+name+"...<br1><img src=\"sek.cbui176\" width=160

 

height=3></body></html>"

return htmltext

elif event == "in":

name = str(st.getPlayer().getName())

htmltext = "<html><body><table

 

width=280><tr><td>Почта:</td><td align=right><table

 

width=220 border=0><tr><td align=right><edit

 

var=\"search\" width=90 length=\"16\"></td><td

 

align=right><combobox width=51 var=keyword

 

list=\"Тема;Автор\"></td><td><button value=\"Поиск\"

 

action=\"bypass -h Quest q8782_ExpressPost find_

 

$search _ $keyword\" width=30 height=17

 

back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table></td></tr></tab

 

le><br>"

htmltext += "<table width=280><tr><td>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Входящие</a><br1>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost out\">Отправленные</a><br>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost adrbook\">Адресная книга</a>"

htmltext += "</td><td align=right>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost pisma\">Написать письмо</a><br>"

htmltext += "</td></table><br>"

htmltext += "Входящие"

htmltext += "<table

 

width=300><tr><td></td><td>Автор</td><td>Тема</td><td

 

>Дата</td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_in` WHERE `to`=? ORDER BY `date` DESC,

 

`time` DESC LIMIT 0,?")

inbox.setString(1, name)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("from")

data=rs.getString("date")

ptype=rs.getInt("type")

time=rs.getString("time")

try :

cdata = str(strftime("%Y-%m-%d", gmtime()))

if cdata == data:

data = "Сегодня "+time+""

if ptype == 1:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"+str

 

(data)+"</td></tr>"

else:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\"><font

 

color=CC00FF>"+str(tema)+"</font></a></td><td>"+str(d

 

ata)+"</td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT

 

COUNT(`to`) FROM `z_post_in` WHERE `to`=?")

getcount.setString(1,name)

rsc=getcount.executeQuery()

if (rsc.next()):

rows = rsc.getInt(1)

vsego = int((rows/LIMIT)+1)

if vsego > 2:

htmltext += "Страницы: "

st.set("stranic",str(vsego))

prvsego = range(1,vsego)

for i in prvsego:

htmltext += ""

htmltext += " <a action=\"bypass -h Quest

 

q8782_ExpressPost str_1_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

else:

htmltext += ""

rsc.close()

getcount.close()

cona.close()

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost home\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event == "out":

name = str(st.getPlayer().getName())

htmltext = "<html><body><table

 

width=280><tr><td>Почта:</td><td

 

align=right></td></tr></table><br>"

htmltext += "<table width=280><tr><td>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Входящие</a><br1>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost out\">Отправленные</a><br>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost adrbook\">Адресная книга</a>"

htmltext += "</td><td align=right>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost pisma\">Написать письмо</a><br>"

htmltext += "</td></table><br>"

htmltext += "Отправленные:"

htmltext += "<table

 

width=300><tr><td></td><td>Адресат</td><td>Тема</td><

 

td>Дата</td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_out` WHERE `from`=? ORDER BY `date` DESC,

 

`time` DESC LIMIT 0,?")

inbox.setString(1, name)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("to")

data=rs.getString("date")

ptype=rs.getInt("type")

time=rs.getString("time")

try :

cdata = str(strftime("%d %m %Y", gmtime()))

if cdata == data:

data = time

htmltext += "<tr><td><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

outshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"+st

 

r(data)+"</td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT

 

COUNT(`from`) FROM `z_post_in` WHERE `from`=?")

getcount.setString(1,name)

rsc=getcount.executeQuery()

if (rsc.next()):

rows = rsc.getInt(1)

vsego = int((rows/LIMIT)+1)

if vsego > 2:

htmltext += "Страницы: "

st.set("stranic",str(vsego))

prvsego = range(1,vsego)

for i in prvsego:

htmltext += ""

htmltext += " <a action=\"bypass -h Quest

 

q8782_ExpressPost str_2_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

else:

htmltext += ""

rsc.close()

getcount.close()

cona.close()

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("inshow_"):

sid = int(event.replace("inshow_", ""))

 

 

con=L2DatabaseFactory.getInstance().getConnection()

show=con.prepareStatement("SELECT * FROM

 

`z_post_in` WHERE `id`=?")

show.setInt(1, sid)

rs=show.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

text=rs.getString("text")

sender=rs.getString("from")

data=rs.getString("date")

time=rs.getString("time")

ptype=rs.getInt("type")

try :

cdata = str(strftime("%d %m %Y", gmtime()))

if cdata == data:

pdata = time

else:

pdata = str(""+data+" ("+time+")")

htmltext = "<html><body><table

 

width=290><tr><td align=left>"+str(tema)+"</td><td

 

align=right><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

in\">Входящие|x</a></td></tr></table><br>"

htmltext += "<table width=300><tr><td

 

align=left>От: "+str(sender)+"</td><td

 

align=right>"+str(pdata)+"</td><td width=55

 

align=right><button value=\"Ответить\"

 

action=\"bypass -h Quest q8782_ExpressPost

 

fpform_"+str(sender)+"\" width=55 height=15

 

back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

htmltext += "<img src=\"sek.cbui355\"

 

width=300 height=2><br>"+str(text)+"<br><br><img

 

src=\"sek.cbui355\" width=300 height=2><br>"

htmltext += "<table width=280><tr><td

 

align=left><button value=\"Доб. контакт\"

 

action=\"bypass -h Quest q8782_ExpressPost adrbook_

 

"+str(sender)+" _ +\" width=80 height=15

 

back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td

 

align=right><button value=\"Удалить письмо\"

 

action=\"bypass -h Quest q8782_ExpressPost

 

del_1_"+str(pid)+"\" width=85 height=15

 

back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Назад.</a></body></html>"

#

if ptype == 0:

 

 

incon=L2DatabaseFactory.getInstance().getConnection()

updatein=incon.prepareStatement("UPDATE

 

z_post_in SET type=1 WHERE id=?")

updatein.setInt(1, pid)

try :

updatein.executeUpdate()

updatein.close()

incon.close()

except :

try : incon.close()

except : pass

except :

try : show.close()

except : pass

try :

con.close()

except :

pass

return htmltext

elif event.startswith("outshow_"):

oid = int(event.replace("outshow_", ""))

 

 

con=L2DatabaseFactory.getInstance().getConnection()

show=con.prepareStatement("SELECT * FROM

 

`z_post_out` WHERE id=?")

show.setInt(1, oid)

rs=show.executeQuery()

while (rs.next()) :

pid=rs.getString("id")

tema=rs.getString("tema")

text=rs.getString("text")

sender=rs.getString("to")

date=rs.getString("date")

time=rs.getString("time")

try :

cdata = str(strftime("%d %m %Y", gmtime()))

if cdata == date:

pdata = time

else:

pdata = str(""+date+" ("+time+")")

htmltext = "<html><body><table

 

width=260><tr><td align=left>"+str(tema)+"</td><td

 

align=right><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

out\">Отправленные|x</a></td></tr></table><br>"

htmltext += "<table width=300><tr><td

 

align=left>Кому: "+str(sender)+"</td><td

 

align=right>"+str(pdata)+"</td></tr></table><br>"

htmltext += "<img src=\"sek.cbui355\"

 

width=300 height=2><br>"+str(text)+"<br><br><img

 

src=\"sek.cbui355\" width=300 height=2><br>"

htmltext += "<table width=280><tr><td

 

align=left></td><td align=right><button

 

value=\"Удалить письмо\" action=\"bypass -h Quest

 

q8782_ExpressPost del_2_"+str(pid)+"\" width=85

 

height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost out\">Назад.</a></body></html>"

except :

try : show.close()

except : pass

try :

con.close()

except :

pass

return htmltext

elif event == "pis_char":

if st.getQuestItemsCount(POSTMARK) < PISMO:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in\">Вернуться.</a></body></html>"

return htmltext

htmltext = "<html><body>Кому:<br>"

htmltext += "<edit var=\"target\" width=200

 

length=\"16\">"

htmltext += "Тема:<br>"

htmltext += "<edit var=\"tema\" width=200

 

length=\"16\">"

htmltext += "Текст:"

htmltext += "<multiedit var=\"text\" width=280

 

height=70><br>"

htmltext += "<button value=\"Отправить\"

 

action=\"bypass -h Quest q8782_ExpressPost send_

 

$target _ $tema _ $text\" width=80 height=15

 

back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("send_ "):

if st.getQuestItemsCount(POSTMARK) < PISMO:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in\">Вернуться.</a></body></html>"

return htmltext

search = str(event.replace("send_ ", ""))

target,tema,text=search.split("_")

#<

target = str(target.replace(" ", ""))

tema = str(tema.replace(" ", ""))

ctext = str(text.replace(" ", ""))

if target == "":

htmltext = "<html><body>Вы не ввели имя

 

получателя.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in\">Вернуться.</a></body></html>"

return htmltext

if tema == "":

tema = "Без темы"

if ctext == "":

text = " "

#<

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT

 

COUNT(char_name) FROM characters WHERE char_name=?")

getcount.setString(1,target)

rsc=getcount.executeQuery()

if (rsc.next()):

if rsc.getInt(1) == 0:

htmltext = "<html><body>Перс с ником

 

"+target+" не найден.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

rsc.close()

getcount.close()

cona.close()

#<

name = str(st.getPlayer().getName())

data = str(strftime("%Y-%m-%d", gmtime()))

time = str(strftime("%H:%M:%S", gmtime()))

uniq = IdFactory.getInstance().getNextId()

#>

 

 

ins=L2DatabaseFactory.getInstance().getConnection()

sendin=ins.prepareStatement("INSERT INTO

 

z_post_in VALUES (?,?,?,?,?,?,?,?)")

sendin.setInt(1, uniq)

sendin.setString(2, tema)

sendin.setString(3, text)

sendin.setString(4, name)

sendin.setString(5, target)

sendin.setInt(6, int(0))

sendin.setString(7, data)

sendin.setString(8, time)

try :

sendin.executeUpdate()

sendin.close()

ins.close()

except :

try : ins.close()

except : pass

#>

 

 

ins=L2DatabaseFactory.getInstance().getConnection()

sendin=ins.prepareStatement("INSERT INTO

 

z_post_out VALUES (?,?,?,?,?,?,?,?)")

sendin.setInt(1, uniq)

sendin.setString(2, tema)

sendin.setString(3, text)

sendin.setString(4, name)

sendin.setString(5, target)

sendin.setInt(6, int(0))

sendin.setString(7, data)

sendin.setString(8, time)

try :

sendin.executeUpdate()

sendin.close()

ins.close()

except :

try : ins.close()

except : pass

#>

alarm = L2World.getInstance().getPlayer(target)

if alarm:

alarm.sendPacket(SystemMessage.sendString("Вам

 

было отправлено письмо!"))

alarm.sendPacket(ExMailArrived())

 

 

alarm.sendPacket(PlaySound("ItemSound.quest_finish"))

#>

st.takeItems(POSTMARK,PISMO)

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Ваше письмо для "+target+"

 

("+tema+") отправлено.<br><br>"

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a><br>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("del_"):

search = str(event.replace("del_", ""))

ptype,pid=search.split("_")

ptype,pid=int(ptype),int(pid)

#>

 

 

con=L2DatabaseFactory.getInstance().getConnection()

if ptype == 1:

sql=con.prepareStatement("DELETE FROM

 

z_post_in WHERE id=?")

else:

sql=con.prepareStatement("DELETE FROM

 

z_post_out WHERE id=?")

delete=sql

delete.setInt(1, pid)

try :

delete.executeUpdate()

delete.close()

con.close()

except :

try : con.close()

except : pass

#>

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Удалено.<br><br>"

if ptype == 1:

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a><br>"

else:

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost out\">Вернуться.</a><br>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("str_"):

search = str(event.replace("str_", ""))

iotype,ioid=search.split("_")

iotype,ioid=int(iotype),int(ioid)

name = str(st.getPlayer().getName())

strCount = st.getInt("stranic")

strList = int(ioid - 1)

ones = {1: 0, 2: LIMIT}

one = ones.get(ioid, int(LIMIT*strList))

two = LIMIT

if iotype == 1:

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Входящие"

htmltext += "<table

 

width=300><tr><td></td><td>Автор</td><td>Тема</td><td

 

>Дата</td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_in` WHERE `to`=? ORDER BY `date` DESC,

 

`time` DESC LIMIT ?,?")

inbox.setString(1, name)

inbox.setInt(2, one)

inbox.setInt(3, two)

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("from")

data=rs.getString("date")

ptype=rs.getInt("type")

time=rs.getString("time")

try :

cdata = str(strftime("%d %m %Y",

 

gmtime()))

if cdata == data:

data = time

if ptype == 1:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"+str

 

(data)+"</td></tr>"

else:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\"><font

 

color=CC00FF>"+str(tema)+"</font></a></td><td>"+str(d

 

ata)+"</td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

elif iotype == 2:

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Отправленные:"

htmltext += "<table

 

width=300><tr><td></td><td>Адресат</td><td>Тема</td><

 

td>Дата</td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_out` WHERE `from`=? ORDER BY `date` DESC,

 

`time` DESC LIMIT ?,?")

inbox.setString(1, name)

inbox.setInt(2, one)

inbox.setInt(3, two)

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("from")

data=rs.getString("date")

ptype=rs.getInt("type")

try :

htmltext += "<tr><td><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

outshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"+st

 

r(data)+"</td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

elif iotype == 3:

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Входящие"

htmltext += "<table

 

width=300><tr><td></td><td>Автор</td><td>Тема</td><td

 

>Дата</td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_pos` WHERE `to`=? ORDER BY `date` DESC,

 

`time` DESC LIMIT 0,?")

inbox.setString(1, name)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("from")

data=rs.getString("date")

ptype=rs.getInt("type")

time=rs.getString("time")

try :

cdata = str(strftime("%d %m %Y",

 

gmtime()))

if cdata == data:

data = time

if ptype == 1:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"+str

 

(data)+"</td></tr>"

else:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\"><font

 

color=CC00FF>"+str(tema)+"</font></a></td><td>"+str(d

 

ata)+"</td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

elif iotype == 4:

ownerId = str(st.getPlayer().getObjectId())

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Список друзей:"

htmltext += "<table

 

width=300><tr><td></td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`character_friends` WHERE `char_id`=? ORDER BY

 

`friend_name` LIMIT 0,?")

inbox.setString(1, ownerId)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

target=rs.getString("friend_name")

try :

if ptype == 1:

htmltext += "<tr><td><a action=\"bypass

 

-h Quest q8782_ExpressPost

 

fpform_"+str(target)+"\">"+str(target)+"</a></td></tr

 

>"

else:

htmltext += "<tr><td><a action=\"bypass

 

-h Quest q8782_ExpressPost

 

fposform_"+str(target)+"\">"+str(target)+"</a></td></

 

tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

elif iotype == 5:

clanId = str(st.getPlayer().getClanId())

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Список сокланов:"

htmltext += "<table

 

width=300><tr><td></td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`characters` WHERE `clanid`=? ORDER BY `clanid`

 

LIMIT 0,?")

inbox.setString(1, clanId)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

target=rs.getString("char_name")

try :

if ptype == 1:

htmltext += "<tr><td><a action=\"bypass

 

-h Quest q8782_ExpressPost

 

fpform_"+str(target)+"\">"+str(target)+"</a></td></tr

 

>"

else:

htmltext += "<tr><td><a action=\"bypass

 

-h Quest q8782_ExpressPost

 

cposform_"+str(target)+"\">"+str(target)+"</a></td></

 

tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

elif iotype == 6:

name = str(st.getPlayer().getName())

htmltext = "<html><body>Почта:<table width=220

 

border=0><tr><td align=right><edit var=\"nick\"

 

width=90 length=\"16\"></td><td align=right><combobox

 

width=15 var=act list=\"+;-\"></td><td><button

 

value=\"Ок\" action=\"bypass -h Quest

 

q8782_ExpressPost adrbook_ $nick _ $act\" width=30

 

height=17 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table>"

htmltext += "<br>Адресная книга"

htmltext += "<table

 

width=300><tr><td></td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_adrbook` WHERE `name`=? ORDER BY `friend`

 

LIMIT 0,?")

inbox.setString(1, name)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

target=rs.getString("friend")

try :

htmltext += "<tr><td><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

fpform_"+str(target)+"\">"+str(target)+"</a></td></tr

 

>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br>Страницы: "

prvsego = range(1,strCount)

for i in prvsego:

htmltext += "<a action=\"bypass -h Quest

 

q8782_ExpressPost str_"+str(iotype)+"_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost home\">Вернуться.</a><br>"

htmltext += "</body></html>"

return htmltext

elif event == "send_pos":

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожذлению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

st.unset("count")

st.unset("stranic")

st.unset("sellitem")

st.unset("grade")

st.unset("type")

htmltext = "<html><body><center><img

 

src=\"L2UI_CH3.herotower_deco\" width=256

 

height=32><br><img src=\"L2UI.SquareBlank\" width=260

 

height=2><br1>"

htmltext += "<table width=256><tr><td

 

width=128><center><font

 

color=37ADFF></font>Приветствую, вы хотите

 

отправить?<br>"

#for i in RAZDELY:

#razdel = trans.get(i, str(""))

#htmltext += "<button value=\""+str(razdel)+"\"

 

action=\"bypass -h Quest q8782_ExpressPost

 

wtss_"+str(i)+"\" width=80 height=15

 

back=\"sek.cbui94\" fore=\"sek.cbui92\"><br1>"

htmltext += "<button value=\"Пушки с ЛС\"

 

action=\"bypass -h Quest q8782_ExpressPost augment\"

 

width=80 height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"><br1>"

htmltext +=

 

"</center></td></tr></table><br><center><img

 

src=\"L2UI_CH3.herotower_deco\" width=256

 

height=32></center>"

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event == "augment":

htmltext = "<html><body><table><tr><td

 

width=260>Аукцион</td><td align=right width=70><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

posilki\">Назад|<-</a></td></tr></table><br1>"

htmltext += "Шаг 1.<br>Выберите

 

шмотку:<br><br><table width=300>"

for item in player.getInventory().getItems():

itemTemplate = item.getItem()

itemId = itemTemplate.getItemId()

itemType = itemTemplate.getType2()

itemGrade = itemTemplate.getCrystalType()

preench = item.getEnchantLevel()

if item.canBeEnchanted() and

 

item.isAugmented() and

 

item.getAugmentation().getAugmentSkill() != None and

 

itemType == 0 and not item.isEquipped():

augment =

 

item.getAugmentation().getAugmentSkill()

augment,level =

 

str(augment.getId()),str(augment.getLevel())

augment = self.getAugmentSkill(int(augment),

 

int(level))

htmltext += "<tr><td><img

 

src=\""+itemTemplate.getIcon()+"\" width=32

 

height=32><br></td><td><a action=\"bypass -h Quest

 

q8782_ExpressPost posonenext_" +

 

str(item.getObjectId()) +"\">" +

 

itemTemplate.getName() + "</a> <font

 

color="+CENCH+">+" + str(preench) + "</font><br1>" +

 

augment + "</td></tr>"

htmltext += "</table><br></body></html>"

return htmltext

elif event.startswith("wtss_"):

wts = int(event.replace("wtss_", ""))

razdel = trans.get(wts, str(""))

htmltext =

 

"<html><body>Почтальон:Посылка:<br>"+str(razdel)+":<b

 

r><table width=300>"

SPWEAPONS =

 

["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","

 

Dual Sword","Dual Fist","Big Sword","Big Blunt"]

SPARMOR =

 

["Shield","Light","Heavy","Magic","None"]

sorts = {1: SPWEAPONS, 2: SPARMOR}#, 3:

 

"Material", 4: "Receipe", 5: "Spellbook", 6: "Shot",

 

7: "Money", 8: EWA, 9: CRY, 10: "Potion", 11: TATOO,

 

12: "Arrow", 13: SACRY, 14: "Rod", 15: QUESTITEMS,

 

16: LIFESTONE}

wtsType = sorts.get(wts, str(""))

#trouble = [8,9,11,13,15]

for Item in player.getInventory().getItems():

itemTemplate = Item.getItem()

idtest = Item.getItemId()

itype = str(Item.getItemType())

if not Item.isEquipped() and idtest != 57 and

 

itype in wtsType:

cnt = Item.getCount()

count = str(cnt)

grade = itemTemplate.getCrystalType()

if grade == 1:

pgrade = str("[D]")

elif grade == 2:

pgrade = str("[C]")

elif grade == 3:

pgrade = str("")

elif grade == 4:

pgrade = str("[A]")

elif grade == 5:

pgrade = str("")

else:

pgrade = str("")

if Item.getEnchantLevel() == 0:

enchant = str("")

else:

enchant = "

 

+"+str(Item.getEnchantLevel())+""

chk = int(count)

count = (count > 1 and str(count)) or

 

str("")

if wts == 7:

s = str(cnt)

for i in xrange(len(s)-3,s[0] in

 

('+','-'),-3):

s=s[:i]+','+s[i:]

count = "<font

 

color=00CCFF>"+str(s)+"</font>"

if chk == 1:

htmltext += "<tr><td><img

 

src=\""+itemTemplate.getIcon()+"\" width=32

 

height=32></td><td><a action=\"bypass -h Quest

 

q8782_ExpressPost posonenext_" +

 

str(Item.getObjectId()) +"\">" +

 

itemTemplate.getName() + ""+str(pgrade)+" " + enchant

 

+ "</a></td></tr>"

else:

htmltext += "<tr><td><img

 

src=\""+itemTemplate.getIcon()+"\" width=32

 

height=32></td><td><a action=\"bypass -h Quest

 

q8782_ExpressPost posmore_" + str(Item.getObjectId())

 

+"\">"+str(count)+" " + itemTemplate.getName() +

 

""+str(pgrade)+" " + enchant + "</a></td></tr>"

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("posonenext_"):

itemObjId = int(event.replace("posonenext_",

 

""))

obj = str(itemObjId)

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

item =

 

player.getInventory().getItemByObjectId(itemObjId)

if item and item.isAugmented() and

 

item.getAugmentation().getAugmentSkill() != None and

 

not item.isEquipped():

itemId = item.getItemId()

itemTemplate = item.getItem()

itemType = itemTemplate.getType2()

preench = item.getEnchantLevel()

augment =

 

item.getAugmentation().getAugmentSkill()

augment,level =

 

str(augment.getId()),str(augment.getLevel())

augment = self.getAugmentSkill(int(augment),

 

int(level))

st.set("sellitem",str(itemObjId))

st.set("enchant",str(preench))

htmltext = "<html><body>Шаг

 

2.<br>Подтверждаете?<br>"

htmltext += "<table width=300><tr><td><img

 

src=\""+itemTemplate.getIcon()+"\" width=32

 

height=32></td><td><font color="+CITEM+">" +

 

itemTemplate.getName() + "</font><font

 

color="+CENCH+">+" + str(preench) + "</font><br>"+

 

augment + "</td></tr></table><br><br>"

htmltext += "Отправить...<br1>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost friend_2\">Другу</a>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost clan_2\">Соклану</a>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost posone_" + str(item.getObjectId())

 

+"\">Персонажу</a>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

else :

htmltext = "<html><body>Ошибка!<br><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("posmorenext_"):

search = str(event.replace("posmorenext_ ", ""))

itemCount,itemObjId=search.split(" _ ")

 

 

itemCount,itemObjId=int(itemCount),int(itemObjId)

obj = str(itemObjId)

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in\">Вернуться.</a></body></html>"

return htmltext

Item =

 

st.getPlayer().getInventory().getItemByObjectId(itemO

 

bjId)

itemTemplate = Item.getItem()

if Item and Item.isAugmented() and

 

Item.getAugmentation().getAugmentSkill() != None and

 

itemTemplate.getDuration() == -1 and not

 

Item.isEquipped() and not Item.isAugmented() and

 

Item.isTradeable():

grade = itemTemplate.getCrystalType()

igrade = str(itemTemplate.getCrystalType())

itype = str(Item.getItemType())

idtest = Item.getItemId()

st.set("sellitem",obj)

st.set("lcount",str(itemCount))

grades = {1: "d", 2: "c", 3: "b", 4: "a", 5:

 

"s"}

pgrade = grades.get(grade, str(""))

enchant = (Item.getEnchantLevel() > 0 and "

 

+"+str(Item.getEnchantLevel())+"") or str("")

htmltext =

 

"<html><body>Почтальон:<br>Заполните форму:<br>"

htmltext += "<table width=300><tr><td><img

 

src=\"" + itemTemplate.getIcon() + "\" width=32

 

height=32></td><td><font color=LEVEL>" +

 

itemTemplate.getName() + " " + enchant + "</font><img

 

src=\"symbol.grade_"+str(pgrade)+"\" width=16

 

height=16><br></td></tr></table><br><br>"

htmltext += "Количество:

 

"+str(itemCount)+"<br>"

htmltext += "Получатель:<br>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost friend_2\">Другу</a>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost clan_2\">Соклану</a>"

htmltext += "<br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posmoreend_"+str(itemCount)+"_"+str(Item.getObjectId(

 

))+"\">Персонажу</a>"

htmltext += "<br><br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

else :

htmltext = "<html><body>Этот предмет нельзя

 

отправить!<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("posone_"):

itemObjId = int(event.replace("posone_", ""))

obj = str(itemObjId)

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

item =

 

player.getInventory().getItemByObjectId(itemObjId)

if item and item.canBeEnchanted() and

 

item.isAugmented() and

 

item.getAugmentation().getAugmentSkill() != None and

 

not item.isEquipped():

itemId = item.getItemId()

itemTemplate = item.getItem()

itemType = itemTemplate.getType2()

preench = item.getEnchantLevel()

augSkill = 0

augment =

 

item.getAugmentation().getAugmentSkill()

augment,level =

 

str(augment.getId()),str(augment.getLevel())

augSkill = int(augment)

augment = self.getAugmentSkill(int(augment),

 

int(level))

htmltext = "<html><body>Шаг 3.<br>Кому<br>"

htmltext += "<table width=300><tr><td><img

 

src=\""+itemTemplate.getIcon()+"\" width=32

 

height=32></td><td><font color="+CITEM+">" +

 

itemTemplate.getName() + "</font><font

 

color="+CENCH+">+" + str(preench) + "</font><br>"+

 

augment + "</td></tr></table><br><br>"

htmltext += "Получатель:"

htmltext += "<edit var=\"target\" width=200

 

length=\"16\"><br>"

htmltext += "Тема:"

htmltext += "<edit var=\"tema\" width=200

 

length=\"16\"><br>"

htmltext += "Текст:"

htmltext += "<multiedit var=\"text\" width=280

 

height=70><br>"

htmltext += "<br><br>Безопасность***:<br>"

htmltext += "Ключевое слово:"

htmltext += "<edit var=\"key\" width=200

 

length=\"16\"><br>"

htmltext += "Coin of Luck:"

htmltext += "<edit var=\"col\" width=50

 

length=\"5\">"

htmltext += "Blue Eva:"

htmltext += "<edit var=\"blueeva\" width=50

 

length=\"5\">"

htmltext += "Gold Golem:"

htmltext += "<edit var=\"goldgolem\" width=50

 

length=\"5\"><br><br>"

htmltext += "<button value=\"Отправить\"

 

action=\"bypass -h Quest q8782_ExpressPost possend_

 

$target _ $tema _ $text _ $key _ $col _ $blueeva _

 

$goldgolem\" width=80 height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"><br>"

htmltext += "<br><br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost posilki\">Вернуться.</a><br>"

htmltext += "*** указываем, сколько получатель

 

должен заплатить за посылку или ключевое

 

слово.</body></html>"

else :

htmltext = "<html><body>Ошибка!<br><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("posmore_"):

itemObjId = int(event.replace("posmore_", ""))

obj = str(itemObjId)

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

Item =

 

st.getPlayer().getInventory().getItemByObjectId(itemO

 

bjId)

itemTemplate = Item.getItem()

if Item and Item.isAugmented() and

 

Item.getAugmentation().getAugmentSkill() != None and

 

itemTemplate.getDuration() == -1 and not

 

Item.isEquipped() and not Item.isAugmented() and

 

Item.isTradeable():

cnt = Item.getCount()

count = str(cnt)

grade = itemTemplate.getCrystalType()

igrade = str(itemTemplate.getCrystalType())

itype = str(Item.getItemType())

idtest = Item.getItemId()

grades = {1: "d", 2: "c", 3: "b", 4: "a", 5:

 

"s"}

pgrade = grades.get(grade, str(""))

enchant = (Item.getEnchantLevel() > 0 and "

 

+"+str(Item.getEnchantLevel())+"") or str("")

st.set("sellitem",obj)

htmltext =

 

"<html><body>Почтальон:<br>Установите

 

количество:<br>"

htmltext += "<table width=300><tr><td><img

 

src=\"" + itemTemplate.getIcon() + "\" width=32

 

height=32></td><td><font color=LEVEL>" +

 

itemTemplate.getName() + " " + enchant + "</font><img

 

src=\"symbol.grade_"+str(pgrade)+"\" width=16

 

height=16><br></td></tr></table><br><br>"

htmltext += "Всего: "+count+"<br>"

htmltext += "Укажите количество: <br>"

htmltext += "<edit var=\"cols\" width=200

 

length=\"16\"><br>"

htmltext += "<button value=\"Ok\"

 

action=\"bypass -h Quest q8782_ExpressPost

 

posmorenext_ $cols _ "+str(obj)+"\" width=40

 

height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"><br>"

htmltext += "<br><br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

else :

htmltext = "<html><body>Этот предмет нельзя

 

отправить!<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("posmoreend_"):

search = str(event.replace("posmoreend_", ""))

itemCount,itemObjId=search.split("_")

 

 

itemCount,itemObjId=int(itemCount),int(itemObjId)

obj = str(itemObjId)

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in\">Вернуться.</a></body></html>"

return htmltext

Item =

 

st.getPlayer().getInventory().getItemByObjectId(itemO

 

bjId)

itemTemplate = Item.getItem()

if Item and Item.isAugmented() and

 

Item.getAugmentation().getAugmentSkill() != None and

 

itemTemplate.getDuration() == -1 and not

 

Item.isEquipped() and not Item.isAugmented() and

 

Item.isTradeable():

grade = itemTemplate.getCrystalType()

igrade = str(itemTemplate.getCrystalType())

itype = str(Item.getItemType())

idtest = Item.getItemId()

st.set("sellitem",obj)

st.set("lcount",str(itemCount))

grades = {1: "d", 2: "c", 3: "b", 4: "a", 5:

 

"s"}

pgrade = grades.get(grade, str(""))

enchant = (Item.getEnchantLevel() > 0 and "

 

+"+str(Item.getEnchantLevel())+"") or str("")

htmltext =

 

"<html><body>Почтальон:<br>Заполните форму:<br>"

htmltext += "<table width=300><tr><td><img

 

src=\"" + itemTemplate.getIcon() + "\" width=32

 

height=32></td><td><font color=LEVEL>" +

 

itemTemplate.getName() + " " + enchant + "</font><img

 

src=\"symbol.grade_"+str(pgrade)+"\" width=16

 

height=16><br></td></tr></table><br><br>"

htmltext += "Количество:

 

"+str(itemCount)+"<br>"

htmltext += "Получатель:<br>"

htmltext += "<edit var=\"target\" width=200

 

length=\"16\">"

htmltext += "Тема:<br>"

htmltext += "<edit var=\"tema\" width=200

 

length=\"16\">"

htmltext += "Текст:"

htmltext += "<multiedit var=\"text\" width=280

 

height=70><br>"

htmltext += "<br><br>Опции зищиты***:<br>"

htmltext += "Ключевое слово:<br>"

htmltext += "<edit var=\"key\" width=50

 

length=\"16\">"

htmltext += "Coin of Luck:<br>"

htmltext += "<edit var=\"col\" width=50

 

length=\"16\">"

htmltext += "Blue Eva:<br>"

htmltext += "<edit var=\"blueeva\" width=50

 

length=\"16\">"

htmltext += "Gold Golem:<br>"

htmltext += "<edit var=\"goldgolem\" width=200

 

length=\"16\"><br><br>"

htmltext += "<button value=\"Отправить\"

 

action=\"bypass -h Quest q8782_ExpressPost possend_

 

$target _ $tema _ $text _ $key _ $col _ $blueeva _

 

$goldgolem\" width=80 height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"><br>"

htmltext += "<br><br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost posilki\">Вернуться.</a><br>"

htmltext += "*** указываем, сколько получатель

 

должен заплатить за посылку или ключевое

 

слово.</body></html>"

else :

htmltext = "<html><body>Этот предмет нельзя

 

отправить!<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("possend_ "):

#htmltext = "<html><body>Перерыв 5

 

минут.</body></html>"

#return htmltext

search = str(event.replace("possend_ ", ""))

 

 

target,tema,text,key,col,blueeva,goldgolem=search.spl

 

it("_")

 

 

target,tema,text,key,col,blueeva,goldgolem=str(target

 

),str(tema),str(text),str(key),str(col),str(blueeva),

 

str(goldgolem)

#<

target = str(target.replace(" ", ""))

tema = str(tema.replace(" ", ""))

ctext = str(text.replace(" ", ""))

key = str(key.replace(" ", ""))

col = str(col.replace(" ", ""))

blueeva = str(blueeva.replace(" ", ""))

goldgolem = str(goldgolem.replace(" ", ""))

if target == "":

htmltext = "<html><body>Вы не ввели имя

 

получателя.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

if tema == "":

tema = "Без темы"

if ctext == "":

text = " "

if key == "":

key = "0"

if col == "":

col = "0"

if blueeva == "":

blueeva = "0"

if goldgolem == "":

goldgolem = "0"

#<

con = None

try:

 

 

con=L2DatabaseFactory.getInstance().getConnection()

stm=con.prepareStatement("SELECT

 

COUNT(char_name) FROM characters WHERE char_name=?")

stm.setString(1,target)

rsc=stm.executeQuery()

if (rsc.next()):

if rsc.getInt(1) == 0:

htmltext = "<html><body>Перс с ником

 

"+target+" не найден.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

self.closeCon(con)

return htmltext

except:

pass

finally:

self.closeRes(rsc)

self.closeStat(stm)

#<

name = str(st.getPlayer().getName())

data = str(strftime("%Y-%m-%d", gmtime()))

time = str(strftime("%H:%M:%S", gmtime()))

uniq = IdFactory.getInstance().getNextId()

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

itemObjId = st.getInt("sellitem")

itemCount = st.getInt("lcount")

myEnch = st.getInt("enchant")

#>

Item =

 

st.getPlayer().getInventory().getItemByObjectId(itemO

 

bjId)

itemTemplate = Item.getItem()

if Item and Item.canBeEnchanted() and

 

Item.isAugmented() and

 

Item.getAugmentation().getAugmentSkill() != None and

 

itemTemplate.getDuration() == -1 and not

 

Item.isEquipped():

itemId = Item.getItemId()

itemName=str(itemTemplate.getName())

count = str(itemCount)

count = (itemCount > 1 and str(itemCount)) or

 

str("")

enchLvl=Item.getEnchantLevel()

if enchLvl != myEnch:

htmltext = "<html><body>К сожалению, у вас

 

не хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

enchant = (enchLvl > 0 and "

 

+"+str(enchLvl)+"") or str("")

augment =

 

Item.getAugmentation().getAugmentSkill()

augEffId =

 

Item.getAugmentation().getAugmentationId()

augSkId,augSkLvl =

 

str(augment.getId()),str(augment.getLevel())

#>

try:

stm = con.prepareStatement("INSERT INTO

 

`z_post_pos`

 

(`id`,`tema`,`text`,`from`,`to`,`type`,`date`,`time`,

 

`itemName`,`itemId`,`itemCount`,`itemEnch`,`augData`,

 

`augSkill`,`augLvl`,`key`,`col`,`blueeva`,`goldgolem`

 

) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")

stm.setString(1, tema)

stm.setString(2, text)

stm.setString(3, name)

stm.setString(4, target)

stm.setInt(5, 0)

stm.setString(6, data)

stm.setString(7, time)

stm.setString(8, itemName)

stm.setInt(9, int(itemId))

stm.setInt(10, 1)

stm.setInt(11, int(enchLvl))

stm.setInt(12, int(augEffId))

stm.setInt(13, int(augSkId))

stm.setInt(14, int(augSkLvl))

stm.setString(15, key)

stm.setString(16, col)

stm.setString(17, blueeva)

stm.setString(18, goldgolem)

stm.execute()

alarm =

 

L2World.getInstance().getPlayer(sName)

if alarm:

alarm.sendMessage("Вам была отправлена

 

посылка!")

alarm.sendPacket(ExMailArrived())

 

 

alarm.sendPacket(PlaySound("ItemSound.quest_finish"))

except:

pass

finally:

self.closeStat(stm)

self.closeCon(con)

#>

st.takeItems(POSTMARK,POSILKA)

 

 

player.destroyItem("q8782_ExpressPost",itemObjId, 1,

 

player, 0)

htmltext = "<html><body>Почтальон:<br>Вашa

 

посылка <font color=LEVEL>"+str(count)+"

 

"+itemName+""+str(enchant)+"</font> для "+target+"

 

("+tema+") отправлена.<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost posilki\">Вернуться.</a>"

#>

alarm =

 

L2World.getInstance().getPlayer(target)

if alarm:

 

 

alarm.sendPacket(SystemMessage.sendString("Вам была

 

отправлена посылка!"))

alarm.sendPacket(ExMailArrived())

 

 

alarm.sendPacket(PlaySound("ItemSound.quest_finish"))

#>

else :

htmltext = "<html><body>Этот предмет нельзя

 

отправить!<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event == "in_pos":

name = str(st.getPlayer().getName())

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Входящие"

htmltext += "<table

 

width=300><tr><td></td><td></td><td></td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_pos` WHERE `to`=? ORDER BY `date` DESC,

 

`time` DESC LIMIT 0,?")

inbox.setString(1, name)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("from")

data=rs.getString("date")

ptype=rs.getInt("type")

time=rs.getString("time")

try :

cdata = str(strftime("%Y-%m-%d", gmtime()))

if cdata == data:

data = time[:5]

if ptype == 1:

htmltext +=

 

"<tr><td>"+str(sender)+"</td><td><a action=\"bypass

 

-h Quest q8782_ExpressPost

 

inposshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"+

 

str(data)+"</td></tr>"

else:

htmltext +=

 

"<tr><td>"+str(sender)+"</td><td><a action=\"bypass

 

-h Quest q8782_ExpressPost

 

inposshow_"+str(pid)+"\"><font

 

color=CC00FF>"+str(tema)+"</font></a></td><td>"+str(d

 

ata)+"</td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT

 

COUNT(`to`) FROM `z_post_pos` WHERE `to`=?")

getcount.setString(1,name)

rsc=getcount.executeQuery()

if (rsc.next()):

rows = rsc.getInt(1)

vsego = int((rows/LIMIT)+1)

if vsego > 1:

htmltext += "Страницы: "

st.set("stranic",str(vsego))

prvsego = range(1,vsego)

for i in prvsego:

htmltext += ""

htmltext += " <a action=\"bypass -h Quest

 

q8782_ExpressPost str_3_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

else:

htmltext += ""

rsc.close()

getcount.close()

cona.close()

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost posilki\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event == "out_pos":

name = str(st.getPlayer().getName())

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Отправленные"

htmltext += "<table

 

width=300><tr><td>Кому</td><td>Тема</td><td>Дата</td>

 

</tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_pos` WHERE `from`=? ORDER BY `date` DESC,

 

`time` DESC LIMIT 0,?")

inbox.setString(1, name)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("to")

data=rs.getString("date")

ptype=rs.getInt("type")

aug=rs.getInt("augData")

time=rs.getString("time")

try :

if len(tema) > 25:

tema = tema[:25]+"..."

cdata = str(strftime("%Y-%m-%d", gmtime()))

if cdata == data:

data = time[:5]

if aug != 0:

htmltext +=

 

"<tr><td>"+str(sender)+"</td><td><a action=\"bypass

 

-h Quest q8782_ExpressPost

 

outposshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"

 

+str(data)+"</td></tr>"

else:

htmltext += "<tr><td><font

 

color=666666>"+str(sender)+"</td><td>"+str(tema)+"</t

 

d><td>"+str(data)+"</font></td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost posilki\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("outposshow_"):

sid = int(event.replace("outposshow_", ""))

 

 

con=L2DatabaseFactory.getInstance().getConnection()

show=con.prepareStatement("SELECT * FROM

 

`z_post_pos` pos WHERE `id`=?")

show.setInt(1, sid)

rs=show.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

text=rs.getString("text")

sender=rs.getString("to")

data=rs.getString("date")

time=rs.getString("time")

ptype=rs.getInt("type")

#>

itemName=rs.getString("itemName")

itemId=rs.getInt("itemId")

itemCount=rs.getInt("itemCount")

itemEnch=rs.getInt("itemEnch")

skill=rs.getInt("augSkill")

attributes=rs.getInt("augData")

try :

item =

 

ItemTable.getInstance().getTemplate(itemId)

if item == None:

htmltext = "<html><body>Посылка не

 

найдена.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in_pos\">Вернуться.</a></body></html>"

return htmltext

enchant = (itemEnch > 0 and "

 

+"+str(itemEnch)+"") or str("")

cdata = str(strftime("%d %m %Y", gmtime()))

count = (itemCount > 1 and str(itemCount))

 

or str("")

if cdata == data:

pdata = time

else:

pdata = str(""+data+" ("+time+")")

if skill != 0:

pskill =

 

SkillTable.getInstance().getInfo(skill, 1)

skillname = pskill.getName()

else:

skillname = "нет."

htmltext = "<html><body><table

 

width=290><tr><td align=left>"+str(tema)+"</td><td

 

align=right><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Посылки|x</a></td></tr></table><br>"

htmltext += "<table width=300><tr><td

 

align=left>Кому: "+str(sender)+"</td><td

 

align=right>"+str(pdata)+"</td><td width=80

 

align=right><button value=\"Доб. контакт\"

 

action=\"bypass -h Quest q8782_ExpressPost adrbook_

 

"+str(sender)+" _ +\" width=80 height=15

 

back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

htmltext += "<table width=300><tr><td

 

width=32><img src=\"" + item.getIcon() + "\" width=32

 

height=32></td><td align=left><font

 

color=LEVEL>"+str(count)+" "+str(itemName)+"

 

"+str(enchant)+"</font></td></tr></table><br>"

htmltext += "Аугмент: "+skillname+"<br>"

htmltext += "<img src=\"sek.cbui355\"

 

width=100 height=2><br>"

htmltext += ""+str(text)+"<br><br><img

 

src=\"sek.cbui355\" width=300 height=2><br><br>"

htmltext += "<table width=280><tr><td

 

align=left><button value=\"Забрать\" action=\"bypass

 

-h Quest q8782_ExpressPost getoutpos_ "+str(pid)+"\"

 

width=55 height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

out_pos\">Назад.</a></body></html>"

except :

try : show.close()

except : pass

try :

con.close()

except :

pass

return htmltext

elif event.startswith("inposshow_"):

sid = int(event.replace("inposshow_", ""))

 

 

con=L2DatabaseFactory.getInstance().getConnection()

show=con.prepareStatement("SELECT * FROM

 

`z_post_pos` pos WHERE `id`=?")

show.setInt(1, sid)

rs=show.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

text=rs.getString("text")

sender=rs.getString("from")

data=rs.getString("date")

time=rs.getString("time")

ptype=rs.getInt("type")

#>

itemName=rs.getString("itemName")

itemId=rs.getInt("itemId")

itemCount=rs.getInt("itemCount")

itemEnch=rs.getInt("itemEnch")

skill=rs.getInt("augSkill")

attributes=rs.getInt("augData")

alvl=rs.getInt("augLvl")

key=rs.getString("key")

col=rs.getInt("col")

blueeva=rs.getInt("blueeva")

goldgolem=rs.getInt("goldgolem")

try :

item =

 

ItemTable.getInstance().getTemplate(itemId)

if item == None:

htmltext = "<html><body>Посылка не

 

найдена.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in_pos\">Вернуться.</a></body></html>"

return htmltext

enchant = (itemEnch > 0 and "

 

+"+str(itemEnch)+"") or str("")

cdata = str(strftime("%d %m %Y", gmtime()))

count = (itemCount > 1 and str(itemCount))

 

or str("")

if cdata == data:

pdata = time

else:

pdata = str(""+data+" ("+time+")")

if skill > 0:

pskill =

 

SkillTable.getInstance().getInfo(skill, alvl)

if pskill.isPassive():

skilltype = "[ Passive:"+str(alvl)+"lvl

 

]"

elif pskill.isChance():

skilltype = "[ Chance:"+str(alvl)+"lvl

 

]"

else:

skilltype = "[ Active:"+str(alvl)+"lvl

 

]"

if pskill.getPower() > 0:

skilltype += " {power:

 

"+str(pskill.getPower())+"}"

skillname = pskill.getName()+" "+skilltype

skillname = skillname.replace("Item Skill:

 

","")

else:

skillname = "НЕТ АУГМЕНТА! Честно-Честно!"

htmltext = "<html><body><table

 

width=290><tr><td align=left>"+str(tema)+"</td><td

 

align=right><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Посылки|x</a></td></tr></table><br>"

htmltext += "<table width=300><tr><td

 

align=left>От: <font

 

color=FFCC33>"+str(sender)+"</font></td><td

 

align=right>"+str(pdata)+"</td><td width=80

 

align=right><button value=\"Доб. контакт\"

 

action=\"bypass -h Quest q8782_ExpressPost adrbook_

 

"+str(sender)+" _ +\" width=80 height=15

 

back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

htmltext += "<table width=300><tr><td

 

width=32><img src=\"" + item.getIcon() + "\" width=32

 

height=32></td><td align=left><font

 

color=LEVEL>"+str(count)+" "+str(itemName)+"

 

"+str(enchant)+"</font></td></tr></table><br>"

htmltext += "<br><font color=FF0099>Аугмент:

 

"+skillname+"</font><br>"

htmltext += "<img src=\"sek.cbui355\"

 

width=100 height=2><br>"

htmltext += ""+str(text)+"<br><br><img

 

src=\"sek.cbui355\" width=300 height=2><br><br>"

ccol,ceva,cgolem=0,0,0

if col > 0:

if st.getQuestItemsCount(4037) < col:

colorcol = "<font

 

color=ff2a00>"+str(col)+"</font>"

ccol = 20

else:

colorcol = "<font

 

color=7fff00>"+str(col)+"</font>"

ccol = 1

htmltext += "(Защита) Coin Of Luck:

 

"+str(colorcol)+"<br>"

if blueeva > 0:

if st.getQuestItemsCount(4355) < blueeva:

coloreva = "<font

 

color=ff2a00>"+str(blueeva)+"</font>"

ceva = 20

else:

coloreva = "<font

 

color=7fff00>"+str(blueeva)+"</font>"

ceva = 1

htmltext += "(Защита) Blue Eva:

 

"+str(coloreva)+"<br>"

if goldgolem > 0:

if st.getQuestItemsCount(5962) <

 

goldgolem:

colorgolem = "<font

 

color=ff2a00>"+str(goldgolem)+"</font>"

cgolem = 20

else:

colorgolem = "<font

 

color=7fff00>"+str(goldgolem)+"</font>"

cgolem = 1

htmltext += "(Защита) Gold Golem:

 

"+str(colorgolem)+"<br>"

fullchk = ccol + ceva + cgolem

if (col != "" or blueeva != "" or goldgolem

 

!= "") and fullchk <= 3:

if key == "0" or key == "":

htmltext += "<table width=280><tr><td

 

align=left><button value=\"Забрать\" action=\"bypass

 

-h Quest q8782_ExpressPost getpos_ "+str(pid)+" _

 

hej4kol\" width=55 height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

else:

htmltext += "Ключ: <edit var=\"key\"

 

width=200 length=\"16\"><br>"

htmltext += "<table width=280><tr><td

 

align=left><button value=\"Забрать\" action=\"bypass

 

-h Quest q8782_ExpressPost getpos_ "+str(pid)+" _

 

$key\" width=55 height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table><br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in_pos\">Назад.</a></body></html>"

#>

if ptype == 0:

 

 

incon=L2DatabaseFactory.getInstance().getConnection()

updatein=incon.prepareStatement("UPDATE

 

z_post_pos SET type=1 WHERE id=?")

updatein.setInt(1, pid)

try :

updatein.executeUpdate()

updatein.close()

incon.close()

except :

try : incon.close()

except : pass

except :

try : show.close()

except : pass

try :

con.close()

except :

pass

return htmltext

elif event.startswith("getpos_ "):

search = str(event.replace("getpos_ ", ""))

pid,key=search.split("_")

pid,key=str(pid),str(key)

#<

pid = str(pid.replace(" ", ""))

key = str(key.replace(" ", ""))

if key == "":

htmltext = "<html><body>Вы не указали кодовое

 

слово.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in_pos\">Вернуться.</a></body></html>"

return htmltext

#<

pid,key=int(pid),str(key)

#<

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT COUNT(id)

 

FROM z_post_pos WHERE id=?")

getcount.setInt(1, pid)

rsc=getcount.executeQuery()

if (rsc.next()):

if rsc.getInt(1) == 0:

htmltext = "<html><body>Посылка не найдена

 

или автор отозвал посылку!<br><br><a action=\"bypass

 

-h Quest q8782_ExpressPost in_pos\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

rsc.close()

getcount.close()

cona.close()

#<

 

 

con=L2DatabaseFactory.getInstance().getConnection()

show=con.prepareStatement("SELECT * FROM

 

`z_post_pos` pos WHERE `id`=?")

show.setInt(1, pid)

rs=show.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

text=rs.getString("text")

sender=rs.getString("from")

data=rs.getString("date")

time=rs.getString("time")

ptype=rs.getInt("type")

#>

itemName=rs.getString("itemName")

itemId=rs.getInt("itemId")

itemCount=rs.getInt("itemCount")

itemEnch=rs.getInt("itemEnch")

skill=rs.getInt("augSkill")

attributes=rs.getInt("augData")

alvl=rs.getInt("augLvl")

skey=rs.getString("key")

scol=rs.getInt("col")

seva=rs.getInt("blueeva")

sgolem=rs.getInt("goldgolem")

try :

if key != "hej4kol" and key != skey:

htmltext = "<html><body>Вы ввели

 

непpарильное ключевое слово.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in_pos\">Вернуться.</a></body></html>"

return htmltext

if scol > 0:

if st.getQuestItemsCount(4037) < scol:

htmltext = "(Защита) Coin Of Luck: <font

 

color=ff2a00>"+str(scol)+"</font><br>"

return htmltext

else:

st.takeItems(4037,scol)

name = str(st.getPlayer().getName())

data = str(strftime("%Y-%m-%d",

 

gmtime()))

time = str(strftime("%H:%M:%S",

 

gmtime()))

uniq =

 

IdFactory.getInstance().getNextId()

tema = "Оплата "+itemName+":

 

"+str(scol)+" Coin Of Luck"

 

 

ins=L2DatabaseFactory.getInstance().getConnection()

sendin=ins.prepareStatement("INSERT INTO

 

z_post_pos VALUES

 

(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")

sendin.setInt(1, uniq)

sendin.setString(2, tema)

sendin.setString(3, tema)

sendin.setString(4, name)

sendin.setString(5, sender)

sendin.setInt(6, int(0))

sendin.setString(7, data)

sendin.setString(8, time)

sendin.setString(9, "Coin Of Luck")

sendin.setInt(10, 4037)

sendin.setInt(11, scol)

sendin.setInt(12, 0)

sendin.setInt(13, 0)

sendin.setInt(14, 0)

sendin.setInt(15, 0)

sendin.setString(16, "")

sendin.setString(17, "")

sendin.setString(18, "")

sendin.setString(19, "")

try :

sendin.executeUpdate()

sendin.close()

ins.close()

except :

try : ins.close()

except : pass

#<

alarm =

 

L2World.getInstance().getPlayer(sender)

if alarm:

 

 

alarm.sendPacket(SystemMessage.sendString("Пришла

 

оплата "+str(scol)+" Coin Of Luck за "+itemName+" от

 

"+str(name)+"!"))

alarm.sendPacket(ExMailArrived())

 

 

alarm.sendPacket(PlaySound("ItemSound.quest_finish"))

 

 

if seva > 0:

if st.getQuestItemsCount(4355) < seva:

htmltext = "(Защита) Blue Eva: <font

 

color=ff2a00>"+str(seva)+"</font><br>"

return htmltext

else:

st.takeItems(4355,seva)

name = str(st.getPlayer().getName())

data = str(strftime("%Y-%m-%d",

 

gmtime()))

time = str(strftime("%H:%M:%S",

 

gmtime()))

uniq =

 

IdFactory.getInstance().getNextId()

tema = "Оплата "+itemName+":

 

"+str(seva)+" Blue Eva"

 

 

ins=L2DatabaseFactory.getInstance().getConnection()

sendin=ins.prepareStatement("INSERT INTO

 

z_post_pos VALUES

 

(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")

sendin.setInt(1, uniq)

sendin.setString(2, tema)

sendin.setString(3, tema)

sendin.setString(4, name)

sendin.setString(5, sender)

sendin.setInt(6, int(0))

sendin.setString(7, data)

sendin.setString(8, time)

sendin.setString(9, "Blue Eva")

sendin.setInt(10, 4355)

sendin.setInt(11, seva)

sendin.setInt(12, 0)

sendin.setInt(13, 0)

sendin.setInt(14, 0)

sendin.setInt(15, 0)

sendin.setString(16, "")

sendin.setString(17, "")

sendin.setString(18, "")

sendin.setString(19, "")

try :

sendin.executeUpdate()

sendin.close()

ins.close()

except :

try : ins.close()

except : pass

#<

alarm =

 

L2World.getInstance().getPlayer(sender)

if alarm:

 

 

alarm.sendPacket(SystemMessage.sendString("Пришла

 

оплата "+str(seva)+" Blue Eva за "+itemName+" от

 

"+str(name)+"!"))

alarm.sendPacket(ExMailArrived())

 

 

alarm.sendPacket(PlaySound("ItemSound.quest_finish"))

if sgolem > 0:

if st.getQuestItemsCount(5962) < sgolem:

htmltext = "(Защита) Gold Golem: <font

 

color=ff2a00>"+str(sgolem)+"</font><br>"

return htmltext

else:

st.takeItems(5962,sgolem)

name = str(st.getPlayer().getName())

data = str(strftime("%Y-%m-%d",

 

gmtime()))

time = str(strftime("%H:%M:%S",

 

gmtime()))

uniq =

 

IdFactory.getInstance().getNextId()

tema = "Оплата "+itemName+":

 

"+str(sgolem)+" Gold Golem"

 

 

ins=L2DatabaseFactory.getInstance().getConnection()

sendin=ins.prepareStatement("INSERT INTO

 

z_post_pos VALUES

 

(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")

sendin.setInt(1, uniq)

sendin.setString(2, tema)

sendin.setString(3, tema)

sendin.setString(4, name)

sendin.setString(5, sender)

sendin.setInt(6, int(0))

sendin.setString(7, data)

sendin.setString(8, time)

sendin.setString(9, "Gold Golem")

sendin.setInt(10, 5962)

sendin.setInt(11, sgolem)

sendin.setInt(12, 0)

sendin.setInt(13, 0)

sendin.setInt(14, 0)

sendin.setInt(15, 0)

sendin.setString(16, "")

sendin.setString(17, "")

sendin.setString(18, "")

sendin.setString(19, "")

try :

sendin.executeUpdate()

sendin.close()

ins.close()

except :

try : ins.close()

except : pass

#<

alarm =

 

L2World.getInstance().getPlayer(sender)

if alarm:

 

 

alarm.sendPacket(SystemMessage.sendString("Пришла

 

оплата "+str(sgolem)+" Gold Golem за "+itemName+" от

 

"+str(name)+"!"))

alarm.sendPacket(ExMailArrived())

 

 

alarm.sendPacket(PlaySound("ItemSound.quest_finish"))

item =

 

player.getInventory().addItem("Quest", itemId,

 

itemCount, player, player.getTarget())

if itemEnch != 0:

item.setEnchantLevel(itemEnch)

if skill != 0:

item.setAugmentation(L2Augmentation(item,

 

attributes, skill, alvl, True))

smsg =

 

SystemMessage(SystemMessageId.EARNED_S2_S1_S)

smsg.addItemName(itemId)

smsg.addNumber(itemCount)

player.sendPacket(smsg)

player.sendPacket(ItemList(player, False))

statusUpdate =

 

StatusUpdate(player.getObjectId())

 

 

statusUpdate.addAttribute(StatusUpdate.CUR_LOAD,

 

player.getCurrentLoad())

player.sendPacket(statusUpdate)

except :

try : show.close()

except : pass

try :

con.close()

except :

pass

#>

 

 

con=L2DatabaseFactory.getInstance().getConnection()

zabiraem=con.prepareStatement("DELETE FROM

 

z_post_pos WHERE id=?")

zabiraem.setInt(1, pid)

try :

zabiraem.executeUpdate()

zabiraem.close()

con.close()

except :

try : con.close()

except : pass

#>

htmltext = "<html><body>Получите -

 

распишитесь.<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost in_pos\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("getoutpos_ "):

pid = int(event.replace("getoutpos_ ", ""))

#>

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT COUNT(id)

 

FROM z_post_pos WHERE id=?")

getcount.setInt(1, pid)

rsc=getcount.executeQuery()

if (rsc.next()):

if rsc.getInt(1) == 0:

htmltext = "<html><body>Посылка не

 

найдена!<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost out_pos\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

rsc.close()

getcount.close()

cona.close()

#>

 

 

con=L2DatabaseFactory.getInstance().getConnection()

show=con.prepareStatement("SELECT * FROM

 

`z_post_pos` pos WHERE `id`=?")

show.setInt(1, pid)

rs=show.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

text=rs.getString("text")

sender=rs.getString("from")

data=rs.getString("date")

time=rs.getString("time")

ptype=rs.getInt("type")

#>

itemName=rs.getString("itemName")

itemId=rs.getInt("itemId")

itemCount=rs.getInt("itemCount")

itemEnch=rs.getInt("itemEnch")

skill=rs.getInt("augSkill")

attributes=rs.getInt("augData")

try :

item =

 

player.getInventory().addItem("Quest", itemId,

 

itemCount, player, player.getTarget())

if itemEnch != 0:

item.setEnchantLevel(itemEnch)

if skill != 0:

item.setAugmentation(L2Augmentation(item,

 

attributes, skill, 10, True))

smsg =

 

SystemMessage(SystemMessageId.EARNED_S2_S1_S)

smsg.addItemName(itemId)

smsg.addNumber(itemCount)

player.sendPacket(smsg)

player.sendPacket(ItemList(player, False))

statusUpdate =

 

StatusUpdate(player.getObjectId())

 

 

statusUpdate.addAttribute(StatusUpdate.CUR_LOAD,

 

player.getCurrentLoad())

player.sendPacket(statusUpdate)

except :

try : show.close()

except : pass

try :

con.close()

except :

pass

#>

 

 

con=L2DatabaseFactory.getInstance().getConnection()

zabiraem=con.prepareStatement("DELETE FROM

 

z_post_pos WHERE id=?")

zabiraem.setInt(1, pid)

try :

zabiraem.executeUpdate()

zabiraem.close()

con.close()

except :

try : con.close()

except : pass

#>

htmltext = "<html><body>Получите -

 

распишитесь.<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost out_pos\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("friend_"):

ptype = int(event.replace("friend_", ""))

ownerId = str(st.getPlayer().getObjectId())

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Список друзей:"

htmltext += "<table

 

width=300><tr><td></td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`character_friends` WHERE `char_id`=? ORDER BY

 

`friend_name` LIMIT 0,?")

inbox.setString(1, ownerId)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

target=rs.getString("friend_name")

try :

if ptype == 1:

htmltext += "<tr><td><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

fpform_"+str(target)+"\">"+str(target)+"</a></td></tr

 

>"

else:

htmltext += "<tr><td><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

fposform_"+str(target)+"\">"+str(target)+"</a></td></

 

tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT

 

COUNT(`char_id`) FROM `character_friends` WHERE

 

`char_id`=?")

getcount.setString(1,ownerId)

rsc=getcount.executeQuery()

if (rsc.next()):

rows = rsc.getInt(1)

vsego = int((rows/LIMIT)+1)

if vsego > 2:

htmltext += "Страницы: "

st.set("stranic",str(vsego))

prvsego = range(1,vsego)

for i in prvsego:

htmltext += ""

htmltext += " <a action=\"bypass -h Quest

 

q8782_ExpressPost str_4_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

else:

htmltext += ""

rsc.close()

getcount.close()

cona.close()

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost home\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("clan_"):

ptype = int(event.replace("clan_", ""))

clanId = str(player.getClanId())

if not player.getClanId():

htmltext = "<html><body>Почтальон:<br>Вы не в

 

клане!<br><a action=\"bypass -h Quest

 

q8782_ExpressPost home\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

htmltext = "<html><body>Почтальон:<br>"

htmltext += "Список сокланов:"

htmltext += "<table

 

width=300><tr><td></td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`characters` WHERE `clanid`=? ORDER BY `clanid`

 

LIMIT 0,?")

inbox.setString(1, clanId)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

target=rs.getString("char_name")

try :

if ptype == 1:

htmltext += "<tr><td><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

fpform_"+str(target)+"\">"+str(target)+"</a></td></tr

 

>"

else:

htmltext += "<tr><td><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

fposform_"+str(target)+"\">"+str(target)+"</a></td></

 

tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT

 

COUNT(`clanid`) FROM `characters` WHERE `clanid`=?")

getcount.setString(1,clanId)

rsc=getcount.executeQuery()

if (rsc.next()):

rows = rsc.getInt(1)

vsego = int((rows/LIMIT)+1)

if vsego > 2:

htmltext += "Страницы: "

st.set("stranic",str(vsego))

prvsego = range(1,vsego)

for i in prvsego:

htmltext += ""

htmltext += " <a action=\"bypass -h Quest

 

q8782_ExpressPost str_5_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

else:

htmltext += ""

rsc.close()

getcount.close()

cona.close()

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost home\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("fpform_"):

target = str(event.replace("fpform_", ""))

if st.getQuestItemsCount(POSTMARK) < PISMO:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in\">Вернуться.</a></body></html>"

return htmltext

htmltext = "<html><body>Кому: "+target+"<br>"

htmltext += "Тема:<br>"

htmltext += "<edit var=\"tema\" width=200

 

length=\"16\">"

htmltext += "Текст:"

htmltext += "<multiedit var=\"text\" width=280

 

height=70><br>"

htmltext += "<button value=\"Отправить\"

 

action=\"bypass -h Quest q8782_ExpressPost send_

 

"+target+" _ $tema _ $text\" width=80 height=15

 

back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("fposform_"):

target = str(event.replace("fposform_", ""))

if st.getQuestItemsCount(POSTMARK) < POSILKA:

htmltext = "<html><body>К сожалению, у вас не

 

хватает почтовых марок.<br>"

htmltext += "<br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

in\">Вернуться.</a></body></html>"

return htmltext

itemObjId = st.getInt("sellitem")

itemCount = st.getInt("lcount")

Item =

 

st.getPlayer().getInventory().getItemByObjectId(itemO

 

bjId)

itemTemplate = Item.getItem()

if Item and itemTemplate.getDuration() == -1 and

 

not Item.isEquipped():

count = str(itemCount)

grade = itemTemplate.getCrystalType()

igrade = str(itemTemplate.getCrystalType())

itype = str(Item.getItemType())

idtest = Item.getItemId()

grades = {1: "d", 2: "c", 3: "b", 4: "a", 5:

 

"s"}

pgrade = grades.get(grade, str(""))

enchant = (Item.getEnchantLevel() > 0 and "

 

+"+str(Item.getEnchantLevel())+"") or str("")

htmltext =

 

"<html><body>Почтальон:<br>Посылка:<br>"

htmltext += "<table width=300><tr><td><img

 

src=\"" + itemTemplate.getIcon() + "\" width=32

 

height=32></td><td><font color=LEVEL>" +

 

itemTemplate.getName() + " " + enchant + "</font><img

 

src=\"symbol.grade_"+str(pgrade)+"\" width=16

 

height=16><br></td></tr></table><br><br>"

htmltext += "Количество: "+count+"<br>"

htmltext += "Получатель: "+target+"<br>"

htmltext += "Тема:<br>"

htmltext += "<edit var=\"tema\" width=200

 

length=\"16\">"

htmltext += "Текст:"

htmltext += "<multiedit var=\"text\" width=280

 

height=70><br>"

htmltext += "<br><br>Дополнительно***:<br>"

htmltext += "Ключевое слово:<br>"

htmltext += "<edit var=\"key\" width=200

 

length=\"16\">"

htmltext += "Coin of Luck:<br>"

htmltext += "<edit var=\"col\" width=200

 

length=\"16\">"

htmltext += "Blue Eva:<br>"

htmltext += "<edit var=\"blueeva\" width=200

 

length=\"16\">"

htmltext += "Gold Golem:<br>"

htmltext += "<edit var=\"goldgolem\" width=200

 

length=\"16\"><br><br>"

htmltext += "<button value=\"Отправить\"

 

action=\"bypass -h Quest q8782_ExpressPost possend_

 

"+target+" _ $tema _ $text _ $key _ $col _ $blueeva _

 

$goldgolem\" width=80 height=15 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"><br>"

htmltext += "<br><br><br><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

posilki\">Вернуться.</a><br><br>"

htmltext += "*** указываем, сколько получатель

 

должен заплатить за посылку или ключевое

 

слово.</body></html>"

else :

htmltext = "<html><body>Этот предмет нельзя

 

отправить!<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost

 

posilki\">Вернуться.</a></body></html>"

return htmltext

elif event.startswith("find_ "):

search = str(event.replace("find_ ", ""))

search,ptype=search.split("_")

search,ptype=str(search),str(ptype)

search = str(search.replace(" ", ""))

ptype = str(ptype.replace(" ", ""))

if search == "":

htmltext = "<html><body>Задан пустой поисковый

 

запрос<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a></body></html>"

return htmltext

name = str(st.getPlayer().getName())

htmltext = "<html><body>Поиск по

 

"+ptype+":"+search+"<br>"

htmltext += "<table

 

width=300><tr><td></td><td>Автор</td><td>Тема</td><td

 

>Дата</td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

if ptype == "Автор":

sql=con.prepareStatement("SELECT * FROM

 

`z_post_in` WHERE `from`=? AND `to`=? ORDER BY

 

`date` DESC, `time` DESC LIMIT 0,?")

else:

sql=con.prepareStatement("SELECT * FROM

 

`z_post_in` WHERE `tema`=? AND `to`=? ORDER BY

 

`date` DESC, `time` DESC LIMIT 0,?")

inbox = sql

inbox.setString(1, search)

inbox.setString(2, name)

inbox.setInt(3, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

pid=rs.getInt("id")

tema=rs.getString("tema")

sender=rs.getString("from")

data=rs.getString("date")

ptype=rs.getInt("type")

time=rs.getString("time")

try :

cdata = str(strftime("%d %m %Y", gmtime()))

if cdata == data:

data = time

if ptype == 1:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\">"+str(tema)+"</a></td><td>"+str

 

(data)+"</td></tr>"

else:

htmltext += "<tr><td width=16><img

 

src=\"Icon.etc_letter_envelope_i00\" width=16

 

height=16></td><td>"+str(sender)+"</td><td><a

 

action=\"bypass -h Quest q8782_ExpressPost

 

inshow_"+str(pid)+"\"><font

 

color=CC00FF>"+str(tema)+"</font></a></td><td>"+str(d

 

ata)+"</td></tr>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

if ptype == "Автор":

sqll=cona.prepareStatement("SELECT

 

COUNT(`from`) FROM `z_post_in` WHERE `from`=? AND

 

`to`=?")

else:

sqll=cona.prepareStatement("SELECT

 

COUNT(`tema`) FROM `z_post_in` WHERE `tema`=? AND

 

`to`=?")

getcount = sqll

getcount.setString(1, search)

getcount.setString(2, name)

rsc=getcount.executeQuery()

if (rsc.next()):

rows = rsc.getInt(1)

vsego = int((rows/LIMIT)+1)

if vsego > 2:

htmltext += "Страницы: "

st.set("stranic",str(vsego))

prvsego = range(1,vsego)

for i in prvsego:

htmltext += ""

htmltext += " <a action=\"bypass -h Quest

 

q8782_ExpressPost str_1_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

else:

htmltext += ""

rsc.close()

getcount.close()

cona.close()

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event == "adrbook":

name = str(st.getPlayer().getName())

htmltext = "<html><body>Почта:<table width=260

 

border=0><tr><td align=right>Контакт:</td><td

 

align=right><edit var=\"nick\" width=90

 

length=\"16\"></td><td align=right><combobox width=30

 

var=act list=\"+;-\"></td><td><button value=\"Ок\"

 

action=\"bypass -h Quest q8782_ExpressPost adrbook_

 

$nick _ $act\" width=30 height=17 back=\"sek.cbui94\"

 

fore=\"sek.cbui92\"></td></tr></table>"

htmltext += "<br>Адресная книга"

htmltext += "<table

 

width=300><tr><td></td></tr>"

 

 

con=L2DatabaseFactory.getInstance().getConnection()

inbox=con.prepareStatement("SELECT * FROM

 

`z_post_adrbook` WHERE `name`=? ORDER BY `friend`

 

LIMIT 0,?")

inbox.setString(1, name)

inbox.setInt(2, int(LIMIT))

rs=inbox.executeQuery()

while (rs.next()) :

target=rs.getString("friend")

try :

htmltext += "<tr><td><a action=\"bypass -h

 

Quest q8782_ExpressPost

 

fpform_"+str(target)+"\">"+str(target)+"</a></td></tr

 

>"

except :

try : inbox.close()

except : pass

try :

con.close()

except :

pass

htmltext += "</table><br><br>"

 

 

cona=L2DatabaseFactory.getInstance().getConnection()

getcount=cona.prepareStatement("SELECT

 

COUNT(`name`) FROM `z_post_adrbook` WHERE `name`=?")

getcount.setString(1,name)

rsc=getcount.executeQuery()

if (rsc.next()):

rows = rsc.getInt(1)

vsego = int((rows/LIMIT)+1)

if vsego > 2:

htmltext += "Страницы: "

st.set("stranic",str(vsego))

prvsego = range(1,vsego)

for i in prvsego:

htmltext += ""

htmltext += " <a action=\"bypass -h Quest

 

q8782_ExpressPost str_6_" + str(i)

 

+"\">"+str(i)+"</a><font color=> </font>"

else:

htmltext += ""

rsc.close()

getcount.close()

cona.close()

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost in\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

elif event.startswith("adrbook_ "):

search = str(event.replace("adrbook_ ", ""))

nick,act=search.split(" _ ")

nick,act=str(nick),str(act)

name = str(st.getPlayer().getName())

htmltext = "<html><body>Управление адресной

 

книгой:<br>"

if act == "+":

 

 

ins=L2DatabaseFactory.getInstance().getConnection()

sendin=ins.prepareStatement("INSERT INTO

 

z_post_adrbook VALUES (?,?)")

sendin.setString(1, name)

sendin.setString(2, nick)

try :

sendin.executeUpdate()

sendin.close()

ins.close()

except :

try : ins.close()

except : pass

htmltext += ""+nick+" добавлен в адресную

 

книгу."

else:

 

 

con=L2DatabaseFactory.getInstance().getConnection()

delete=con.prepareStatement("DELETE FROM

 

z_post_adrbook WHERE name=? AND friend=?")

delete.setString(1, name)

delete.setString(2, nick)

try :

delete.executeUpdate()

delete.close()

con.close()

except :

try : con.close()

except : pass

htmltext += ""+nick+" удален из адресной

 

книги."

#>

htmltext += "<br><br><a action=\"bypass -h Quest

 

q8782_ExpressPost adrbook\">Вернуться.</a>"

htmltext += "</body></html>"

return htmltext

return

 

def onTalk (self,npc,player):

st = player.getQuestState(qn)

npcId = npc.getNpcId()

if npcId == POSTMAN:

self.startQuestTimer("home",100,None,player)

 

 

return

 

QUEST = Quest(8782,qn,"custom")

CREATED = State('Start', QUEST)

 

QUEST.setInitialState(CREATED)

 

QUEST.addStartNpc(POSTMAN)

QUEST.addTalkId(POSTMAN)

 

 

 

Крит нумеро 2

 

 

Error on: бла бла

 

бла\data\scripts\custom\q8782_ExpressPost\__init__.py

 

.error.log

Line: -1 - Column: -1

 

Traceback (innermost last):

(no code object) at line 0

SyntaxError: ('invalid syntax', ('__init__.py', 36,

 

2, ' X \xB0'))

 

Хотелось бы узнать решение данной проблемы. Сборка

 

Еон 3.1.4

 

И по - возможности ткнуть носом (а еще лучше ссылкой)

 

на такие же НПЦ, где мб импорты поменять и

 

все...ну...дело за Вами, форумчане)

 

Памагайте spiteful.gif

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Даже читать не хочется, оформляй нормально. +10% преждевременное поднятие темы

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

ппц мало того что неадыкват дык еще темы прально создбавать не может! в след раз вот такую беребельду в споил кидай

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Мб вы таки оффтоп вырубите все и по теме будете говорить?

как видно исходя из всего, что там написано - человек пытается установить аукцион для сервера.

+1 меня такое тоже интересует) не могли бы ктонибудь из вас скинуть ссыль на рабочий (РЕАЛЬНО РАБОЧИЙ) аукцион? :D

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Извиняюсь за флуд.

Ребят вас не учили спойлером пользоваться ?

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...