Вот 1:
import sys
from com.l2jfree import Config
from com.l2jfree import L2DatabaseFactory
from com.l2jfree.gameserver import Olympiad
from com.l2jfree.gameserver import SevenSigns
from com.l2jfree.gameserver.datatables import CharNameTable
from com.l2jfree.gameserver.datatables import CharTemplateTable
from com.l2jfree.gameserver.datatables import SkillTable
from com.l2jfree.gameserver.communitybbs.Manager import RegionBBSManager
from com.l2jfree.gameserver.model import L2World
from com.l2jfree.gameserver.model.quest import State
from com.l2jfree.gameserver.model.quest import QuestState
from com.l2jfree.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jfree.gameserver.network.serverpackets import EtcStatusUpdate
from com.l2jfree.gameserver.network.serverpackets import PledgeShowInfoUpdate
from com.l2jfree.tools.random import Rnd
qn = "8707_Services"
NPC = 8705
ITEM = 5588
CHANGENAMEITEMCOUNT = 100
TRANSFERCHARITEMCOUNT = 200
NAMECHARS = {
"name_A" : "A",
"name_B" : "B",
"name_C" : "C",
"name_D" : "D",
"name_E" : "E",
"name_F" : "F",
"name_G" : "G",
"name_H" : "H",
"name_I" : "I",
"name_J" : "J",
"name_K" : "K",
"name_L" : "L",
"name_M" : "M",
"name_N" : "N",
"name_O" : "O",
"name_P" : "P",
"name_Q" : "Q",
"name_R" : "R",
"name_S" : "S",
"name_T" : "T",
"name_U" : "U",
"name_V" : "V",
"name_W" : "W",
"name_X" : "X",
"name_Y" : "Y",
"name_Z" : "Z",
"name_a" : "a",
"name_b" : "b",
"name_c" : "c",
"name_d" : "d",
"name_e" : "e",
"name_f" : "f",
"name_g" : "g",
"name_h" : "h",
"name_i" : "i",
"name_j" : "j",
"name_k" : "k",
"name_l" : "l",
"name_m" : "m",
"name_n" : "n",
"name_o" : "o",
"name_p" : "p",
"name_q" : "q",
"name_r" : "r",
"name_s" : "s",
"name_t" : "t",
"name_u" : "u",
"name_v" : "v",
"name_w" : "w",
"name_x" : "x",
"name_y" : "y",
"name_z" : "z",
"name_0" : "0",
"name_1" : "1",
"name_2" : "2",
"name_3" : "3",
"name_4" : "4",
"name_5" : "5",
"name_6" : "6",
"name_7" : "7",
"name_8" : "8",
"name_9" : "9"
}
ACCOUNTCHARS = {
"transfer_A" : "A",
"transfer_B" : "B",
"transfer_C" : "C",
"transfer_D" : "D",
"transfer_E" : "E",
"transfer_F" : "F",
"transfer_G" : "G",
"transfer_H" : "H",
"transfer_I" : "I",
"transfer_J" : "J",
"transfer_K" : "K",
"transfer_L" : "L",
"transfer_M" : "M",
"transfer_N" : "N",
"transfer_O" : "O",
"transfer_P" : "P",
"transfer_Q" : "Q",
"transfer_R" : "R",
"transfer_S" : "S",
"transfer_T" : "T",
"transfer_U" : "U",
"transfer_V" : "V",
"transfer_W" : "W",
"transfer_X" : "X",
"transfer_Y" : "Y",
"transfer_Z" : "Z",
"transfer_a" : "a",
"transfer_b" : "b",
"transfer_c" : "c",
"transfer_d" : "d",
"transfer_e" : "e",
"transfer_f" : "f",
"transfer_g" : "g",
"transfer_h" : "h",
"transfer_i" : "i",
"transfer_j" : "j",
"transfer_k" : "k",
"transfer_l" : "l",
"transfer_m" : "m",
"transfer_n" : "n",
"transfer_o" : "o",
"transfer_p" : "p",
"transfer_q" : "q",
"transfer_r" : "r",
"transfer_s" : "s",
"transfer_t" : "t",
"transfer_u" : "u",
"transfer_v" : "v",
"transfer_w" : "w",
"transfer_x" : "x",
"transfer_y" : "y",
"transfer_z" : "z",
"transfer_0" : "0",
"transfer_1" : "1",
"transfer_2" : "2",
"transfer_3" : "3",
"transfer_4" : "4",
"transfer_5" : "5",
"transfer_6" : "6",
"transfer_7" : "7",
"transfer_8" : "8",
"transfer_9" : "9"
}
def findAccount(newAccount) :
con = L2DatabaseFactory.getInstance().getConnection()
offline = con.prepareStatement("SELECT account_name FROM characters WHERE account_name = ?")
offline.setString(1, str(newAccount))
rs = offline.executeQuery()
if rs :
rs.next()
try :
newAccount = rs.getString("account_name")
newAccount = True
con.close()
except :
newAccount = None
try : con.close()
except : pass
else :
newAccount = None
return newAccount
class Quest (JQuest) :
def __init__(self, id, name, descr) :
JQuest.__init__(self, id, name, descr)
def onAdvEvent(self, event, npc, player) :
st = player.getQuestState(qn)
htmltext = event
if event == "changeName.htm" :
st.set("newName","")
htmltext = st.showHtmlFile("changeName.htm").replace("%newName%", " ")
elif event in NAMECHARS.keys() :
newName = NAMECHARS[event]
st.set("newName", st.get("newName") + str(newName))
newName = st.get("newName")
htmltext = st.showHtmlFile("changeName.htm").replace("%newName%", str(newName))
elif event == "changeMyName" :
if st.getQuestItemsCount(ITEM) < CHANGENAMEITEMCOUNT :
htmltext = "<html><head><body> You dont Have Enought item to use this Action!</body></html>"
else :
newName = st.get("newName")
if newName :
if player.isHero() :
htmltext = "<html><head><body>Hero Players Can't Change Name!</body></html>"
elif player.isCursedWeaponEquipped() :
htmltext = "<html><head><body> You Can't Change Name, Cursed Weapon!</body></html>"
elif player.isTransformed() :
htmltext = "<html><head><body> You Can't use This Action in Transformation!</body></html>"
elif Olympiad.getInstance().isRegisteredInComp(player) :
htmltext = "<html><head><body> You Can't when Practice in Olympiad!</body></html>"
else :
if Config.CNAME_PATTERN.matcher(newName).matches() :
if CharNameTable.getInstance().doesCharNameExist(newName) :
st.unset("newName")
htmltext = "<html><head><body> This Name Already Exist!</body></html>"
else :
if player.isInParty() :
htmltext = "You Must Remove From Party!"
else :
L2World.getInstance().removeFromAllPlayers(player)
player.setName(newName)
player.store()
L2World.getInstance().addToAllPlayers(player)
player.broadcastUserInfo()
if player.getClan() :
player.getClan().broadcastClanStatus()
RegionBBSManager.getInstance().changeCommunityBoard()
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE auction_bid SET bidderName = ? WHERE bidderId = ?")
offline.setString(1, newName)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE characters_custom_data SET char_name = ? WHERE charId = ?")
offline.setString(1, newName)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE character_friends SET friend_name = ? WHERE friendId = ?")
offline.setString(1, newName)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE heroes SET char_name = ? WHERE charId = ?")
offline.setString(1, newName)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE olympiad_nobles SET char_name = ? WHERE charId = ?")
offline.setString(1, newName)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE posts SET post_owner_name = ? WHERE post_ownerid = ?")
offline.setString(1, newName)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE topic SET topic_ownername = ? WHERE topic_ownerid = ?")
offline.setString(1, newName)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
st.takeItems(ITEM, CHANGENAMEITEMCOUNT)
htmltext = "<html><head><body>Congratulation, Your Name Changed.</body></html>"
st.playSound("ItemSound.quest_finish")
st.unset("newName")
st.exitQuest(1)
else :
htmltext = "<html><head><body> Something went wrong, Try Again!</body></html>"
else :
htmltext = "<html><head><body> Something went wrong, Try Again!</body></html>"
elif event == "transferChar.htm" :
st.set("newAccount","")
htmltext = st.showHtmlFile("transferChar.htm").replace("%newAccount%", " ")
elif event in ACCOUNTCHARS.keys() :
newAccount = ACCOUNTCHARS[event]
st.set("newAccount", st.get("newAccount") + str(newAccount))
newAccount = st.get("newAccount")
htmltext = st.showHtmlFile("transferChar.htm").replace("%newAccount%", str(newAccount))
elif event == "transferChar" :
if st.getQuestItemsCount(ITEM) < TRANSFERCHARITEMCOUNT :
htmltext = "cant.htm"
else :
if player.isCursedWeaponEquipped() :
htmltext = "<html><head><body> You Can't Make This Action, Cursed Weapon!</body></html>"
elif player.isTransformed() :
htmltext = "<html><head><body> You Can't use This Action in Transformation!</body></html>"
elif Olympiad.getInstance().isRegisteredInComp(player) :
htmltext = "<html><head><body> You Can't when Practice in Olympiad!</body></html>"
else :
newAccount = st.get("newAccount")
if newAccount :
if Config.CNAME_PATTERN.matcher(newAccount).matches() :
if findAccount(newAccount) == None :
htmltext = "<html><head><body> Sorry, This Account Don't Exist or dont have Any Character!</body></html>"
elif str(newAccount) == player.getAccountName() :
htmltext = "<html><head><body> This is your Curent Account, You Cant use this Action!</body></html>"
else :
con = L2DatabaseFactory.getInstance().getConnection(None)
offline = con.prepareStatement("UPDATE characters SET account_name = ? WHERE charId = ?")
offline.setString(1, newAccount)
offline.setInt(2, player.getObjectId())
try :
offline.executeUpdate()
offline.close()
con.close()
except :
try : con.close()
except : pass
AutoChat(npc, "Congratulation "+player.getName()+". You performed the function successfully. In order to complete the function you need to re-login.")
st.unset("newAccount")
st.takeItems(ITEM, TRANSFERCHARITEMCOUNT)
htmltext = "<html><head><body> Your Character Transfered in other Account!</body></html>"
st.playSound("ItemSound.quest_finish")
st.exitQuest(1)
player.closeNetConnection()
else :
htmltext = "<html><head><body> Something went wrong. Try Again!</body></html>"
else :
htmltext = "<html><head><body> Something went wrong. Try Again!</body></html>"
return htmltext
def onTalk(self, npc, player) :
htmltext = ""
st = player.getQuestState(qn)
if not st :
st = self.newQuestState(player)
htmltext = "home.htm"
st.playSound("ItemSound.quest_accept")
return htmltext
QUEST = Quest(8707,qn,"custom")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
________________________________________________________________________________
__________________________
вот 2:
import sys
from com.it.br.gameserver.model.actor.instance import L2PcInstance
from com.it.br.gameserver.model.actor.appearance import PcAppearance
from com.it.br.gameserver.model.quest import State
from com.it.br.gameserver.model.quest import QuestState
from com.it.br.gameserver.model.quest.jython import QuestJython as JQuest
qn = "7800_Namecolor"
NPC=[7802]
QuestId = 7800
QuestName = "Namecolor"
QuestDesc = "custom"
InitialHtml = "1.htm"
print "Loaded Custom: 7001 Namecolor"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st) :
htmltext = event
if event == "1":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0x009900)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
st.exitQuest(0)
if event == "2":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0xff7f00)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
if event == "3":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0xff00ff)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
if event == "4":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0x00ffff)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
if event == "5":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0x0000ff)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
if event == "6":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0x0099ff)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
if event == "7":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0x70db93)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
if event == "8":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0x9f9f9f)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
if event == "9":
if st.getQuestItemsCount(57) > 250000:
st.takeItems(57,250000)
st.getPlayer().getAppearance().setNameColor(0xffff00)
st.getPlayer().broadcastUserInfo();
return "1.htm"
if st.getQuestItemsCount(57) <= 250000:
return "Announcements: No Enought Adena To Select Color!"
def onTalk (self,npc,player):
st = player.getQuestState(qn)
htmltext = "<html><head><body><center>Nao tenho nada para dizer agora.</center></body></html>"
st.setState(STARTED)
return InitialHtml
QUEST = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
CREATED=State('Start',QUEST)
STARTED=State('Started',QUEST)
COMPLETED=State('Completed',QUEST)
QUEST.setInitialState(CREATED)
for npcId in NPC:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)
________________________________________________________________________________
__________________________
-Помогите зделать импорты под l2jfrozen-