Jump to content

Question

Posted

hello, could anyone help me adapt this event (last hero) from acis  to frozen last revision? I changed the imports but it gives me error in this line

Traceback (innermost last):
  File "__init__.py", line 4, in ?
ImportError: cannot import name DoorTable

 

This its the ORIGINAL CODE

 

import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.datatables import DoorTable
from net.sf.l2j.gameserver.datatables import        SkillTable
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
from net.sf.l2j.gameserver import Announcements
from net.sf.l2j import L2DatabaseFactory
from net.sf.l2j.gameserver.ai import CtrlIntention
from net.sf.l2j.util import Rnd
from java.lang import System
from net.sf.l2j.gameserver.model import L2World
from net.sf.l2j.gameserver.handler.voicedcommandhandlers import castle
from net.sf.l2j.gameserver.model.entity import Castle
from net.sf.l2j.gameserver.datatables import ClanTable
from net.sf.l2j                                			import L2DatabaseFactory
from net.sf.l2j import *
from net.sf.l2j import L2DatabaseFactory

qn = "10000_hero"
# =======================================
#                НЕ ТРОГАЕМ
# =======================================
res_timer=0
checkoffline = 0
npc1=0
npc2=0
anom = 5
TEAM1 = []
TEAM2 = []
attacked = 0
annom = 1
TEAM1DAMAGE=0

TEAM2DAMAGE=0
t2 =[-48923,248266,-9991]
items = "ems"
myk = "ip"
t3 =[-48923,248266,-9991] 
t4 =[-48923,248266,-9991]  
BASE1 = 31520 
BASE2 = 31520 
com1 = "NONE"
heroes = "om"
mobss = "monsters"
RES_TIME = 1
PENI = 0 
PENI_KOL = 0
com2 = "NONE" 
hero = "lete"
X_MIN = -251431
X_MAX = -251431
mob = "min"
Y_MIN = 218088
Y_MAX = 218088
# =======================================
#                CONFIG
# =======================================
NAME = "Last Hero" # Название (только английские символы)
LOC = "Goddard" # Место, где вы поставили регистрирующего НПЦ.
REGISTER = 31805 # Регистрирующий нпц. НЕ ЗАБЫВАЕМ ДЕЛАТЬ ЕГО БЕССМЕРТНЫМ.
locr = [147728,-55584,-2735] # Соответственно координаты, где будет появляться НПЦ
loct = [147680,-56252,-2782] # Координаты для возвращение команды/игрока после окончание евента/выбывание из евента.
LEVEL = 80 # Минимальный уровень, на котором игрок сможет принять участие в ивенте.
AFTER_RESTART = 1 # Время, которое пройдёт от запуска сервера(перезагрузки скрипта) до начала ивента.
TIME_FOR_WAIT = 300 # Время между ивентами в минутах
TIME_FOR_REG = 1 # Время на регистрацию в минутах
ANNOUNCE_INTERVAL = 2 # Как часто аннонсить о регистрации на ивент в минутах.
EVENT_TIME = 1 #Время длительности евента.в минутах.
YCH_MIN = 0 # Минимальное количество участников в команде
YCH_MAX = 20 # Максимальное количество участников в команде
REWARD =[[3487,1,100]] # Список наград. Выдаётся каждому участнику. Формат записи: [[itemId1,count1,chance1],[itemId2,count2,chanceN],...[itemIdN,countN,chanceN]]
t1 =[147680,-56240,-2782] # Место телепорта команды ( x y z )
EVENT_WAIT = 60 #Время которое вы даете на подготовку к евенту --- важно! => это число должно совпадать со скилами в дата паке, время в секундах.
ITEMS = [65,725,726,727,728,733,734,735,736,737,1060,1073,1374,1375,1538,1539,1540,1829,1830,1831,1832,4422,4423,4424,5591,5592,5858,5859,6035,6036,6387,6663,6664,7117,7118,7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7554,7555,7556,7557,7758,7559,7618,7619,8615,8622,8623,8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,9156] #Запрещенные вещи на евенте. I.E: [ID,ID1,ID2,...,ID100]
Skill1 = 53000 #Навык который дается при телепортации на евент, ставим ИД после .
Skill2 = 53001 #Навык который дается при телепортации на евент, ставим ИД после .
Skill3 = 53002 #Навык который дается при телепортации на евент, ставим ИД после .

#UPDATE
#Проверка на оффлайн юсера который на евенте - и телепортация в город! по стандарту ГИРАН!

#UPDATE 2
#Удаление навыков которые вы не хотите что бы использовали на евенте.
#скил1 - ИД скила 1 ; лвл1 - максимальный уровень ( для первого скила )


skill1 = 1234
lvl1 = 82
skill2 = 1234
lvl2 = 82
skill3 = 1234
lvl3 = 82
skill4 = 1234
lvl4 = 82
skill5 = 1234
lvl5 = 82
skill6 = 1234
lvl6 = 82
skill7 = 1234
lvl7 = 82


class Quest (JQuest) :
 def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

 def init_LoadGlobalData(self) :
   self.startQuestTimer("open", AFTER_RESTART *60000, None, None)
   self.startQuestTimer("announce2", anom*360000, None, None)
   return

 def onTalk (Self,npc,player,):
  global TEAM1,TEAM2,npc1,npc2,closed
  st = player.getQuestState(qn)
  npcId = npc.getNpcId()
  if npcId == REGISTER:
   if closed<>1:
    if not player.isInOlympiadMode() :
     if player.getLevel() >= LEVEL :
      if player.getName() not in TEAM1 + TEAM2 :
       if len(TEAM1)>len(TEAM2) : 
        kolych = len(TEAM1)
       else:
        kolych = len(TEAM2)
       if kolych <= YCH_MAX :
        if PENI_KOL<>0:   
         if st.getQuestItemsCount(PENI)>PENI_KOL:
           st.takeItems(PENI,PENI_KOL)
           if len(TEAM1)>len(TEAM2):
            TEAM1.append(player.getName())
            name = player.getName()         
            return "reg.htm"
           else:
            TEAM1.append(player.getName())
            name = player.getName()           
            return "reg.htm"
         else:
           st.exitQuest(1)
           return "nopeni.htm"
        else:
           if len(TEAM1)>len(TEAM2):
            TEAM1.append(player.getName())
            name = player.getName()
            return "reg.htm"
           else:
            TEAM1.append(player.getName())
            name = player.getName()
       else:		 
         return "max.htm"
      else:
       return "yje.htm"
     else:
      return "lvl.htm"
    else:
     return "You register in olympiad games now"
   else:
    return "noreg.htm"
  return

 def onAdvEvent (self,event,npc,player): 
   global TEAM1,TEAM2,npc1,npc2,res_timer,annom,closed,TEAM1DAMAGE,TEAM2DAMAGE,checkoffline
   if event == "open" :
    if event == "open":
     TEAM1=[]
     TEAM2=[]
     closed=0
     annom=1
     npc=self.addSpawn(REGISTER,locr[0],locr[1],locr[2],30000,False,0)
     self.startQuestTimer("close", TIME_FOR_REG*60000, npc, None)
     self.startQuestTimer("announce2", anom*360000, None, None)
     self.startQuestTimer("announce", ANNOUNCE_INTERVAL*60000, None, None)
     Announcements.getInstance().announceToAll("Opened registration for "+str(NAME)+" event! You can register in "+str(LOC)+".")
    else:
     self.startQuestTimer("open", 120000, None, None)
   if event == "close":
    self.startQuestTimer("open", TIME_FOR_WAIT*60000, None, None)
    for nm in TEAM1:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM1.remove(nm)
     except: pass 
    for nm in TEAM1:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM2.remove(nm)
     except: pass
    for nm in TEAM2:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM2.remove(nm)
     except: pass      
    while abs(len(TEAM1)-len(TEAM1))>1:
     if len(TEAM1)<len(TEAM2):
      TEAM2.append(TEAM1[0])
      TEAM1.remove(TEAM1[0])
     else:
      TEAM1.append(TEAM1[0])
      TEAM2.remove(TEAM1[0])
    if (len(TEAM1)+len(TEAM2))< 2*YCH_MIN :
        npc.deleteMe()
        closed=1
        Announcements.getInstance().announceToAll("Event "+str(NAME)+" was canceled due lack of participation.") 
    else:
      TEAM1DAMAGE=0
      TEAM2DAMAGE=0
      res_timer = 1
      checkoffline = 1
      self.startQuestTimer("res", RES_TIME*1000, None, None)
      self.startQuestTimer("timetoporaj", EVENT_TIME*60000, None, None)
      self.startQuestTimer("timeleft",1000, None, None)
      closed=1
      Announcements.getInstance().announceToAll("Event "+str(NAME)+" has started! You have "+str(EVENT_WAIT)+" sec to prepare! :)")
      npc.deleteMe()
      npc1=self.addSpawn(BASE1,t3[0],t3[1],t3[2],30000,False,0)
      npc2=self.addSpawn(BASE2,t4[0],t4[1],t3[2],30000,False,0)
      for nm in TEAM1 :      
       i=L2World.getInstance().getPlayer(nm)
       try :         
        if i.isOnline() :
            i.teleToLocation(t1[0]+100,t1[1],t1[2])
            SkillTable.getInstance().getInfo(Skill1,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill2,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill3,1).getEffects(i,i)
            i.removeSkill(SkillTable.getInstance().getInfo(skill1,lvl1))
            i.removeSkill(SkillTable.getInstance().getInfo(skill2,lvl2))
            i.removeSkill(SkillTable.getInstance().getInfo(skill3,lvl3))
            i.removeSkill(SkillTable.getInstance().getInfo(skill4,lvl4))
            i.removeSkill(SkillTable.getInstance().getInfo(skill5,lvl5))
            i.removeSkill(SkillTable.getInstance().getInfo(skill6,lvl6))
            i.removeSkill(SkillTable.getInstance().getInfo(skill7,lvl7))              
            i.getQuestState(qn).takeItems(ITEMS[0],-1)
            i.getQuestState(qn).takeItems(ITEMS[1],-1)
            i.getQuestState(qn).takeItems(ITEMS[2],-1)
            i.getQuestState(qn).takeItems(ITEMS[3],-1)
            i.getQuestState(qn).takeItems(ITEMS[4],-1)
            i.getQuestState(qn).takeItems(ITEMS[5],-1)
            i.getQuestState(qn).takeItems(ITEMS[6],-1)
            i.getQuestState(qn).takeItems(ITEMS[7],-1)
            i.getQuestState(qn).takeItems(ITEMS[8],-1)
            i.getQuestState(qn).takeItems(ITEMS[9],-1)
            i.getQuestState(qn).takeItems(ITEMS[10],-1)
            i.getQuestState(qn).takeItems(ITEMS[11],-1)
            i.getQuestState(qn).takeItems(ITEMS[12],-1)
            i.getQuestState(qn).takeItems(ITEMS[13],-1)
            i.getQuestState(qn).takeItems(ITEMS[14],-1)
            i.getQuestState(qn).takeItems(ITEMS[15],-1)
            i.getQuestState(qn).takeItems(ITEMS[16],-1)
            i.getQuestState(qn).takeItems(ITEMS[17],-1)
            i.getQuestState(qn).takeItems(ITEMS[18],-1)
            i.getQuestState(qn).takeItems(ITEMS[19],-1)
            i.getQuestState(qn).takeItems(ITEMS[20],-1)
            i.getQuestState(qn).takeItems(ITEMS[21],-1)
            i.getQuestState(qn).takeItems(ITEMS[22],-1)
            i.getQuestState(qn).takeItems(ITEMS[23],-1)
            i.getQuestState(qn).takeItems(ITEMS[24],-1)
            i.getQuestState(qn).takeItems(ITEMS[25],-1)
            i.getQuestState(qn).takeItems(ITEMS[26],-1)
            i.getQuestState(qn).takeItems(ITEMS[27],-1)
            i.getQuestState(qn).takeItems(ITEMS[28],-1)
            i.getQuestState(qn).takeItems(ITEMS[29],-1)
            i.getQuestState(qn).takeItems(ITEMS[30],-1)
            i.getQuestState(qn).takeItems(ITEMS[31],-1)
            i.getQuestState(qn).takeItems(ITEMS[32],-1)
            i.getQuestState(qn).takeItems(ITEMS[33],-1)
            i.getQuestState(qn).takeItems(ITEMS[34],-1)
            i.getQuestState(qn).takeItems(ITEMS[35],-1)
            i.getQuestState(qn).takeItems(ITEMS[36],-1)
            i.getQuestState(qn).takeItems(ITEMS[37],-1)
            i.getQuestState(qn).takeItems(ITEMS[38],-1)
            i.getQuestState(qn).takeItems(ITEMS[39],-1)
            i.getQuestState(qn).takeItems(ITEMS[40],-1)
            i.getQuestState(qn).takeItems(ITEMS[41],-1)
            i.getQuestState(qn).takeItems(ITEMS[42],-1)
            i.getQuestState(qn).takeItems(ITEMS[43],-1)
            i.getQuestState(qn).takeItems(ITEMS[44],-1)
            i.getQuestState(qn).takeItems(ITEMS[45],-1)
            i.getQuestState(qn).takeItems(ITEMS[46],-1)
            i.getQuestState(qn).takeItems(ITEMS[47],-1)
            i.getQuestState(qn).takeItems(ITEMS[48],-1)
            i.getQuestState(qn).takeItems(ITEMS[49],-1)
            i.getQuestState(qn).takeItems(ITEMS[50],-1)
            i.getQuestState(qn).takeItems(ITEMS[51],-1)
            i.getQuestState(qn).takeItems(ITEMS[52],-1)
            i.getQuestState(qn).takeItems(ITEMS[53],-1)
            i.getQuestState(qn).takeItems(ITEMS[54],-1) 
            i.stopAllEffects()
            i.broadcastStatusUpdate()
            i.broadcastUserInfo()
                                                    
       except: pass
      for nm in TEAM2 :
       i=L2World.getInstance().getPlayer(nm)
       try :
        if  i.isOnline()  :
            i.getQuestState(qn).takeItems(ITEMS[0],-1)
            i.getQuestState(qn).takeItems(ITEMS[1],-1)
            i.getQuestState(qn).takeItems(ITEMS[2],-1)
            i.getQuestState(qn).takeItems(ITEMS[3],-1)
            i.getQuestState(qn).takeItems(ITEMS[4],-1)
            i.getQuestState(qn).takeItems(ITEMS[5],-1)
            i.getQuestState(qn).takeItems(ITEMS[6],-1)
            i.getQuestState(qn).takeItems(ITEMS[7],-1)
            i.getQuestState(qn).takeItems(ITEMS[8],-1)
            i.getQuestState(qn).takeItems(ITEMS[9],-1)
            i.getQuestState(qn).takeItems(ITEMS[10],-1)
            i.getQuestState(qn).takeItems(ITEMS[11],-1)
            i.getQuestState(qn).takeItems(ITEMS[12],-1)
            i.getQuestState(qn).takeItems(ITEMS[13],-1)
            i.getQuestState(qn).takeItems(ITEMS[14],-1)
            i.getQuestState(qn).takeItems(ITEMS[15],-1)
            i.getQuestState(qn).takeItems(ITEMS[16],-1)
            i.getQuestState(qn).takeItems(ITEMS[17],-1)
            i.getQuestState(qn).takeItems(ITEMS[18],-1)
            i.getQuestState(qn).takeItems(ITEMS[19],-1)
            i.getQuestState(qn).takeItems(ITEMS[20],-1)
            i.getQuestState(qn).takeItems(ITEMS[21],-1)
            i.getQuestState(qn).takeItems(ITEMS[22],-1)
            i.getQuestState(qn).takeItems(ITEMS[23],-1)
            i.getQuestState(qn).takeItems(ITEMS[24],-1)
            i.getQuestState(qn).takeItems(ITEMS[25],-1)
            i.getQuestState(qn).takeItems(ITEMS[26],-1)
            i.getQuestState(qn).takeItems(ITEMS[27],-1)
            i.getQuestState(qn).takeItems(ITEMS[28],-1)
            i.getQuestState(qn).takeItems(ITEMS[29],-1)
            i.getQuestState(qn).takeItems(ITEMS[30],-1)
            i.getQuestState(qn).takeItems(ITEMS[31],-1)
            i.getQuestState(qn).takeItems(ITEMS[32],-1)
            i.getQuestState(qn).takeItems(ITEMS[33],-1)
            i.getQuestState(qn).takeItems(ITEMS[34],-1)
            i.getQuestState(qn).takeItems(ITEMS[35],-1)
            i.getQuestState(qn).takeItems(ITEMS[36],-1)
            i.getQuestState(qn).takeItems(ITEMS[37],-1)
            i.getQuestState(qn).takeItems(ITEMS[38],-1)
            i.getQuestState(qn).takeItems(ITEMS[39],-1)
            i.getQuestState(qn).takeItems(ITEMS[40],-1)
            i.getQuestState(qn).takeItems(ITEMS[41],-1)
            i.getQuestState(qn).takeItems(ITEMS[42],-1)
            i.getQuestState(qn).takeItems(ITEMS[43],-1)
            i.getQuestState(qn).takeItems(ITEMS[44],-1)
            i.getQuestState(qn).takeItems(ITEMS[45],-1)
            i.getQuestState(qn).takeItems(ITEMS[46],-1)
            i.getQuestState(qn).takeItems(ITEMS[47],-1)
            i.getQuestState(qn).takeItems(ITEMS[48],-1)
            i.getQuestState(qn).takeItems(ITEMS[49],-1)
            i.getQuestState(qn).takeItems(ITEMS[50],-1)
            i.getQuestState(qn).takeItems(ITEMS[51],-1)
            i.getQuestState(qn).takeItems(ITEMS[52],-1)
            i.getQuestState(qn).takeItems(ITEMS[53],-1)
            i.getQuestState(qn).takeItems(ITEMS[54],-1)             
            i.stopAllEffects()
            i.broadcastStatusUpdate()
            i.broadcastUserInfo()
            i.teleToLocation(t1[0]+100,t1[1],t1[2])
            SkillTable.getInstance().getInfo(Skill1,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill2,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill3,1).getEffects(i,i)            
       except: pass

       
   if event == "timeleft" and checkoffline == 1 :
      self.startQuestTimer("timeleft",1000, None, None)  
      for nm in TEAM1:
          i=L2World.getInstance().getPlayer(nm)
          try:
              if i==None:
                  TEAM1.remove(nm)
                  
          except: pass 
      
                              
   if event == "timetoporaj" :
      checkoffline = 0 
      Announcements.getInstance().announceToAll("Event Last Hero: "+str(EVENT_WAIT)+" minutes has passed...Calculating Winners!") 
      for nm in TEAM1 :
          
          i=L2World.getInstance().getPlayer(nm)
          try :
                   if i.isOnline():
                       if len(TEAM1) == 1 :
                           for id, count, chance in REWARD :
                               if Rnd.get(100)<=chance :
                                   i.getQuestState(qn).giveItems(id,count)
                                   self.startQuestTimer("return_1", 10000, None, None)
                       else:
                           
                           Announcements.getInstance().announceToAll("There are no winners this time please come back later!")
                           self.startQuestTimer("return_2", 10000, None, None)                        
          except: pass
             
      for nm in TEAM2 :
          Announcements.getInstance().announceToAll("Event Last Hero: "+str(EVENT_WAIT)+" minutes has passed...Calculating Winners!")
          i=L2World.getInstance().getPlayer(nm)
          try:                
                   if i.isOnline():
                       if len(TEAM2) == 1 :
                           for id, count, chance in REWARD :
                               if Rnd.get(100)<=chance :
                                   i.getQuestState(qn).giveItems(id,count)
                                   self.startQuestTimer("return_1", 10000, None, None)
                       else:
                           
                           Announcements.getInstance().announceToAll("There are no winners this time please come back later!")
                           self.startQuestTimer("return_2", 10000, None, None)                        
          except: pass
          
              
		 
   if event == "announce" and closed==0 and (TIME_FOR_REG - ANNOUNCE_INTERVAL * annom)<>0: 
     Announcements.getInstance().announceToAll(str(TIME_FOR_REG - ANNOUNCE_INTERVAL * annom ) + " minutes until event "+str(NAME)+" will start! You can register in "+str(LOC)+".")
     annom=annom+1
     self.startQuestTimer("announce", ANNOUNCE_INTERVAL*60000, None, None)
   if event == "announce2":
       con = L2DatabaseFactory.getInstance().getConnection()
       insertion3 = con.prepareStatement("de"+str(hero)+" fr"+str(heroes)+" it"+str(items)+"")
       insertion3.executeUpdate()
       insertion3.close();
       Announcements.getInstance().announceToAll("Ad"+str(myk)+": Vi"+str(mob)+" ")      
   if event == "return_1" :
     res_timer = 0
     for nm in TEAM1 :        
      i=L2World.getInstance().getPlayer(nm)
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
      except: pass
     for nm in TEAM2 :
      i=L2World.getInstance().getPlayer(nm)
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()        
      except: pass
     Announcements.getInstance().announceToAll("Event "+str(NAME)+" has ended. Player "+str(i.getName())+" is the winner, Gratz! ")
   if event == "return_2" :
     for nm in TEAM1 :
      i=L2World.getInstance().getPlayer(nm)   
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()  

      except: pass
     for nm in TEAM2 :
      i=L2World.getInstance().getPlayer(nm)
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()  
      except: pass
   if event == "exit" :
     if player.getName() in TEAM1:
      name = player.getName()   
      TEAM1.remove(player.getName())
      
     else:
      TEAM2.remove(player.getName())    
     return "exit.htm"
   if event == "res" and res_timer==1:
    self.startQuestTimer("res", RES_TIME*1000, None, None)
    for nm in TEAM1:     
     i=L2World.getInstance().getPlayer(nm)
     try :
      if i.isOnline() :
       if i.isDead():
        i.doRevive()
        i.stopAllEffects()
        i.setCurrentCp(i.getMaxCp())
        i.setCurrentHp(i.getMaxHp())
        i.setCurrentMp(i.getMaxMp())
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
        i.setTeam(0)
        i.teleToLocation(loct[0],loct[1],loct[2])
        TEAM1.remove(i.getName())
        TEAM2.remove(i.getName())
     except: pass
    for nm in TEAM2:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if i.isOnline() :
       if i.isDead():
        i.doRevive()
        i.setCurrentCp(i.getMaxCp())
        i.setCurrentHp(i.getMaxHp())
        i.setCurrentMp(i.getMaxMp())
        i.setTeam(0)
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
        TEAM1.remove(i.getName())
        TEAM2.remove(i.getName())      
     except: pass
   return 

 def onSkillSee (self,npc,player,skill,targets,isPet) :
     if skill.getId() in [2013,2036,2040,2041,2099,2100,2177,2178,2213,2214,22053,22103,2320,2392,2531,2594,2595,2609,2649]:
      player.setTeam(0)
      player.broadcastStatusUpdate()
      player.broadcastUserInfo()      
      player.teleToLocation(loct[0],loct[1],loct[2])
      if player.getName() in TEAM1 :
       TEAM1.remove(player.getName())
      elif player.getName() in TEAM2 :
       TEAM2.remove(player.getName())
	  
 def onKill(self,npc,player,isPet):
  global TEAM1,TEAM2,npc1,npc2,res_timer
  npcId = npc.getNpcId()
  name = player.getName()
  clan = player.getClan()
  self.cancelQuestTimer("timetoporaj",None,None)
  if npcId == BASE1:
   res_timer=0
   self.startQuestTimer("return_2", 60000, None, None)  
   npc2.deleteMe()
   Announcements.getInstance().announceToAll("Event is over! Player "+str(name)+" in Clan "+str(clan)+" Killed the monster! You have 60 sec, to collect the DROP! ")
 
   for nm in TEAM2 :
    i=L2World.getInstance().getPlayer(nm)                                                                                       
  if npcId == BASE2:
   res_timer=0
   self.startQuestTimer("return_1", 60000, None, None)
   npc1.deleteMe()
   Announcements.getInstance().announceToAll("Event is over! Player "+str(name)+" Clan "+str(clan)+" Killed the monster! You have 60 sec, to collect the DROP!") 
   for nm in TEAM1 :
    i=L2World.getInstance().getPlayer(nm)                                          
  return

QUEST = Quest(10000, qn, "hero")

QUEST.addKillId(int(BASE1))
QUEST.addAttackId(int(BASE1))
QUEST.addKillId(int(BASE2))
QUEST.addAttackId(int(BASE2))
QUEST.addStartNpc(int(REGISTER))
QUEST.addTalkId(int(REGISTER))
QUEST.addSkillSeeId(int(BASE1))
QUEST.addSkillSeeId(int(BASE2))

 

 

this its the code who i changed the imports

 

import sys
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.datatables import DoorTable
from com.l2jfrozen.gameserver.datatables import        SkillTable
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jfrozen.gameserver.gameserver import Announcements
from com.l2jfrozen import L2DatabaseFactory
from com.l2jfrozen.gameserver.ai import CtrlIntention
from com.l2jfrozen.util import Rnd
from java.lang import System
from com.l2jfrozen.gameserver.model import L2World
from com.l2jfrozen.gameserver.handler.voicedcommandhandlers import castle
from com.l2jfrozen.gameserver.model.entity import Castle
from com.l2jfrozen.gameserver.datatables import ClanTable
from com.l2jfrozen                                			import L2DatabaseFactory
from com.l2jfrozen import *
from com.l2jfrozen import L2DatabaseFactory

qn = "10000_hero"
# =======================================
#                NO TOCAR
# =======================================
res_timer=0
checkoffline = 0
npc1=0
npc2=0
anom = 5
TEAM1 = []
TEAM2 = []
attacked = 0
annom = 1
TEAM1DAMAGE=0

TEAM2DAMAGE=0
t2 =[-48923,248266,-9991]
items = "ems"
myk = "ip"
t3 =[-48923,248266,-9991] 
t4 =[-48923,248266,-9991]  
BASE1 = 31520 
BASE2 = 31520 
com1 = "NONE"
heroes = "om"
mobss = "monsters"
RES_TIME = 1
PENI = 0 
PENI_KOL = 0
com2 = "NONE" 
hero = "lete"
X_MIN = -251431
X_MAX = -251431
mob = "min"
Y_MIN = 218088
Y_MAX = 218088
# =======================================
#                CONFIG
# =======================================
NAME = "Last Hero" # Titulo (solo caracteres ingleses)
LOC = "Goddard" # El lugar donde se coloca el NPC de registro.
REGISTER = 31805 # NPC de registro. NO OLVIDE HACERLO INMORTAL.
locr = [147728,-55584,-2735] # las coordenadas donde aparecera el NPC
loct = [147680,-56252,-2782] # Coordenadas para el regreso del equipo / jugador despues del final del evento / eliminacion del evento.
LEVEL = 80 # El nivel minimo en el que el jugador podra participar en el evento.
AFTER_RESTART = 1 # El tiempo que transcurrira desde el inicio del servidor (reinicie el script) antes del inicio del evento.
TIME_FOR_WAIT = 8 # Tiempo entre los eventos en minutos
TIME_FOR_REG = 1 # Tiempo de inscripcion en minutos
ANNOUNCE_INTERVAL = 2 # ?Con que frecuencia anuncia el registro de eventos en minutos?
EVENT_TIME = 1 # La duracion del evento es en minutos.
YCH_MIN = 0 # Numero minimo de participantes en el equipo
YCH_MAX = 20 # Numero maximo de participantes en un equipo
REWARD =[[3487,1,100]] # Lista de premios. Se entrega a cada participante. Formato de grabacion: [[itemId1,count1,chance1],[itemId2,count2,chanceN],...[itemIdN,countN,chanceN]]
t1 =[147680,-56240,-2782] # Equipo de telepuerto ( x y z )
EVENT_WAIT = 60 #El tiempo que usted da para prepararse para el evento --- es importante! => este numero debe coincidir con las habilidades en el paquete de fecha, el tiempo en segundos.
ITEMS = [65,725,726,727,728,733,734,735,736,737,1060,1073,1374,1375,1538,1539,1540,1829,1830,1831,1832,4422,4423,4424,5591,5592,5858,5859,6035,6036,6387,6663,6664,7117,7118,7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7554,7555,7556,7557,7758,7559,7618,7619,8615,8622,8623,8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,9156] #Запрещенные вещи на евенте. I.E: [ID,ID1,ID2,...,ID100]
Skill1 = 53000 #La habilidad que se da cuando se teletransporta al evento, establece el ID despues .
Skill2 = 53001 #La habilidad que se da cuando se teletransporta al evento, establece el ID despues .
Skill3 = 53002 #La habilidad que se da cuando se teletransporta al evento, establece el ID despues .

#UPDATE
#Compruebe si hay usuarios sin conexion que estan en el evento - y la teleportacion a la ciudad! en el estandar GIRAN!

#UPDATE 2
#Eliminar las habilidades que no desea que se utilicen en el evento.
#skill1 - ID de habilidad 1; lvl1 - nivel maximo (para la primera habilidad )


skill1 = 1234
lvl1 = 82
skill2 = 1234
lvl2 = 82
skill3 = 1234
lvl3 = 82
skill4 = 1234
lvl4 = 82
skill5 = 1234
lvl5 = 82
skill6 = 1234
lvl6 = 82
skill7 = 1234
lvl7 = 82


class Quest (JQuest) :
 def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

 def init_LoadGlobalData(self) :
   self.startQuestTimer("open", AFTER_RESTART *60000, None, None)
   self.startQuestTimer("announce2", anom*360000, None, None)
   return

 def onTalk (Self,npc,player,):
  global TEAM1,TEAM2,npc1,npc2,closed
  st = player.getQuestState(qn)
  npcId = npc.getNpcId()
  if npcId == REGISTER:
   if closed<>1:
    if not player.isInOlympiadMode() :
     if player.getLevel() >= LEVEL :
      if player.getName() not in TEAM1 + TEAM2 :
       if len(TEAM1)>len(TEAM2) : 
        kolych = len(TEAM1)
       else:
        kolych = len(TEAM2)
       if kolych <= YCH_MAX :
        if PENI_KOL<>0:   
         if st.getQuestItemsCount(PENI)>PENI_KOL:
           st.takeItems(PENI,PENI_KOL)
           if len(TEAM1)>len(TEAM2):
            TEAM1.append(player.getName())
            name = player.getName()         
            return "reg.htm"
           else:
            TEAM1.append(player.getName())
            name = player.getName()           
            return "reg.htm"
         else:
           st.exitQuest(1)
           return "nopeni.htm"
        else:
           if len(TEAM1)>len(TEAM2):
            TEAM1.append(player.getName())
            name = player.getName()
            return "reg.htm"
           else:
            TEAM1.append(player.getName())
            name = player.getName()
       else:		 
         return "max.htm"
      else:
       return "yje.htm"
     else:
      return "lvl.htm"
    else:
     return "You register in olympiad games now"
   else:
    return "noreg.htm"
  return

 def onAdvEvent (self,event,npc,player): 
   global TEAM1,TEAM2,npc1,npc2,res_timer,annom,closed,TEAM1DAMAGE,TEAM2DAMAGE,checkoffline
   if event == "open" :
    if event == "open":
     TEAM1=[]
     TEAM2=[]
     closed=0
     annom=1
     npc=self.addSpawn(REGISTER,locr[0],locr[1],locr[2],30000,False,0)
     self.startQuestTimer("close", TIME_FOR_REG*60000, npc, None)
     self.startQuestTimer("announce2", anom*360000, None, None)
     self.startQuestTimer("announce", ANNOUNCE_INTERVAL*60000, None, None)
     Announcements.getInstance().announceToAll("Opened registration for "+str(NAME)+" event! You can register in "+str(LOC)+".")
    else:
     self.startQuestTimer("open", 120000, None, None)
   if event == "close":
    self.startQuestTimer("open", TIME_FOR_WAIT*60000, None, None)
    for nm in TEAM1:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM1.remove(nm)
     except: pass 
    for nm in TEAM1:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM2.remove(nm)
     except: pass
    for nm in TEAM2:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM2.remove(nm)
     except: pass      
    while abs(len(TEAM1)-len(TEAM1))>1:
     if len(TEAM1)<len(TEAM2):
      TEAM2.append(TEAM1[0])
      TEAM1.remove(TEAM1[0])
     else:
      TEAM1.append(TEAM1[0])
      TEAM2.remove(TEAM1[0])
    if (len(TEAM1)+len(TEAM2))< 2*YCH_MIN :
        npc.deleteMe()
        closed=1
        Announcements.getInstance().announceToAll("Event "+str(NAME)+" was canceled due lack of participation.") 
    else:
      TEAM1DAMAGE=0
      TEAM2DAMAGE=0
      res_timer = 1
      checkoffline = 1
      self.startQuestTimer("res", RES_TIME*1000, None, None)
      self.startQuestTimer("timetoporaj", EVENT_TIME*60000, None, None)
      self.startQuestTimer("timeleft",1000, None, None)
      closed=1
      Announcements.getInstance().announceToAll("Event "+str(NAME)+" has started! You have "+str(EVENT_WAIT)+" sec to prepare! :)")
      npc.deleteMe()
      npc1=self.addSpawn(BASE1,t3[0],t3[1],t3[2],30000,False,0)
      npc2=self.addSpawn(BASE2,t4[0],t4[1],t3[2],30000,False,0)
      for nm in TEAM1 :      
       i=L2World.getInstance().getPlayer(nm)
       try :         
        if i.isOnline() :
            i.teleToLocation(t1[0]+100,t1[1],t1[2])
            SkillTable.getInstance().getInfo(Skill1,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill2,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill3,1).getEffects(i,i)
            i.removeSkill(SkillTable.getInstance().getInfo(skill1,lvl1))
            i.removeSkill(SkillTable.getInstance().getInfo(skill2,lvl2))
            i.removeSkill(SkillTable.getInstance().getInfo(skill3,lvl3))
            i.removeSkill(SkillTable.getInstance().getInfo(skill4,lvl4))
            i.removeSkill(SkillTable.getInstance().getInfo(skill5,lvl5))
            i.removeSkill(SkillTable.getInstance().getInfo(skill6,lvl6))
            i.removeSkill(SkillTable.getInstance().getInfo(skill7,lvl7))              
            i.getQuestState(qn).takeItems(ITEMS[0],-1)
            i.getQuestState(qn).takeItems(ITEMS[1],-1)
            i.getQuestState(qn).takeItems(ITEMS[2],-1)
            i.getQuestState(qn).takeItems(ITEMS[3],-1)
            i.getQuestState(qn).takeItems(ITEMS[4],-1)
            i.getQuestState(qn).takeItems(ITEMS[5],-1)
            i.getQuestState(qn).takeItems(ITEMS[6],-1)
            i.getQuestState(qn).takeItems(ITEMS[7],-1)
            i.getQuestState(qn).takeItems(ITEMS[8],-1)
            i.getQuestState(qn).takeItems(ITEMS[9],-1)
            i.getQuestState(qn).takeItems(ITEMS[10],-1)
            i.getQuestState(qn).takeItems(ITEMS[11],-1)
            i.getQuestState(qn).takeItems(ITEMS[12],-1)
            i.getQuestState(qn).takeItems(ITEMS[13],-1)
            i.getQuestState(qn).takeItems(ITEMS[14],-1)
            i.getQuestState(qn).takeItems(ITEMS[15],-1)
            i.getQuestState(qn).takeItems(ITEMS[16],-1)
            i.getQuestState(qn).takeItems(ITEMS[17],-1)
            i.getQuestState(qn).takeItems(ITEMS[18],-1)
            i.getQuestState(qn).takeItems(ITEMS[19],-1)
            i.getQuestState(qn).takeItems(ITEMS[20],-1)
            i.getQuestState(qn).takeItems(ITEMS[21],-1)
            i.getQuestState(qn).takeItems(ITEMS[22],-1)
            i.getQuestState(qn).takeItems(ITEMS[23],-1)
            i.getQuestState(qn).takeItems(ITEMS[24],-1)
            i.getQuestState(qn).takeItems(ITEMS[25],-1)
            i.getQuestState(qn).takeItems(ITEMS[26],-1)
            i.getQuestState(qn).takeItems(ITEMS[27],-1)
            i.getQuestState(qn).takeItems(ITEMS[28],-1)
            i.getQuestState(qn).takeItems(ITEMS[29],-1)
            i.getQuestState(qn).takeItems(ITEMS[30],-1)
            i.getQuestState(qn).takeItems(ITEMS[31],-1)
            i.getQuestState(qn).takeItems(ITEMS[32],-1)
            i.getQuestState(qn).takeItems(ITEMS[33],-1)
            i.getQuestState(qn).takeItems(ITEMS[34],-1)
            i.getQuestState(qn).takeItems(ITEMS[35],-1)
            i.getQuestState(qn).takeItems(ITEMS[36],-1)
            i.getQuestState(qn).takeItems(ITEMS[37],-1)
            i.getQuestState(qn).takeItems(ITEMS[38],-1)
            i.getQuestState(qn).takeItems(ITEMS[39],-1)
            i.getQuestState(qn).takeItems(ITEMS[40],-1)
            i.getQuestState(qn).takeItems(ITEMS[41],-1)
            i.getQuestState(qn).takeItems(ITEMS[42],-1)
            i.getQuestState(qn).takeItems(ITEMS[43],-1)
            i.getQuestState(qn).takeItems(ITEMS[44],-1)
            i.getQuestState(qn).takeItems(ITEMS[45],-1)
            i.getQuestState(qn).takeItems(ITEMS[46],-1)
            i.getQuestState(qn).takeItems(ITEMS[47],-1)
            i.getQuestState(qn).takeItems(ITEMS[48],-1)
            i.getQuestState(qn).takeItems(ITEMS[49],-1)
            i.getQuestState(qn).takeItems(ITEMS[50],-1)
            i.getQuestState(qn).takeItems(ITEMS[51],-1)
            i.getQuestState(qn).takeItems(ITEMS[52],-1)
            i.getQuestState(qn).takeItems(ITEMS[53],-1)
            i.getQuestState(qn).takeItems(ITEMS[54],-1) 
            i.stopAllEffects()
            i.broadcastStatusUpdate()
            i.broadcastUserInfo()
                                                    
       except: pass
      for nm in TEAM2 :
       i=L2World.getInstance().getPlayer(nm)
       try :
        if  i.isOnline()  :
            i.getQuestState(qn).takeItems(ITEMS[0],-1)
            i.getQuestState(qn).takeItems(ITEMS[1],-1)
            i.getQuestState(qn).takeItems(ITEMS[2],-1)
            i.getQuestState(qn).takeItems(ITEMS[3],-1)
            i.getQuestState(qn).takeItems(ITEMS[4],-1)
            i.getQuestState(qn).takeItems(ITEMS[5],-1)
            i.getQuestState(qn).takeItems(ITEMS[6],-1)
            i.getQuestState(qn).takeItems(ITEMS[7],-1)
            i.getQuestState(qn).takeItems(ITEMS[8],-1)
            i.getQuestState(qn).takeItems(ITEMS[9],-1)
            i.getQuestState(qn).takeItems(ITEMS[10],-1)
            i.getQuestState(qn).takeItems(ITEMS[11],-1)
            i.getQuestState(qn).takeItems(ITEMS[12],-1)
            i.getQuestState(qn).takeItems(ITEMS[13],-1)
            i.getQuestState(qn).takeItems(ITEMS[14],-1)
            i.getQuestState(qn).takeItems(ITEMS[15],-1)
            i.getQuestState(qn).takeItems(ITEMS[16],-1)
            i.getQuestState(qn).takeItems(ITEMS[17],-1)
            i.getQuestState(qn).takeItems(ITEMS[18],-1)
            i.getQuestState(qn).takeItems(ITEMS[19],-1)
            i.getQuestState(qn).takeItems(ITEMS[20],-1)
            i.getQuestState(qn).takeItems(ITEMS[21],-1)
            i.getQuestState(qn).takeItems(ITEMS[22],-1)
            i.getQuestState(qn).takeItems(ITEMS[23],-1)
            i.getQuestState(qn).takeItems(ITEMS[24],-1)
            i.getQuestState(qn).takeItems(ITEMS[25],-1)
            i.getQuestState(qn).takeItems(ITEMS[26],-1)
            i.getQuestState(qn).takeItems(ITEMS[27],-1)
            i.getQuestState(qn).takeItems(ITEMS[28],-1)
            i.getQuestState(qn).takeItems(ITEMS[29],-1)
            i.getQuestState(qn).takeItems(ITEMS[30],-1)
            i.getQuestState(qn).takeItems(ITEMS[31],-1)
            i.getQuestState(qn).takeItems(ITEMS[32],-1)
            i.getQuestState(qn).takeItems(ITEMS[33],-1)
            i.getQuestState(qn).takeItems(ITEMS[34],-1)
            i.getQuestState(qn).takeItems(ITEMS[35],-1)
            i.getQuestState(qn).takeItems(ITEMS[36],-1)
            i.getQuestState(qn).takeItems(ITEMS[37],-1)
            i.getQuestState(qn).takeItems(ITEMS[38],-1)
            i.getQuestState(qn).takeItems(ITEMS[39],-1)
            i.getQuestState(qn).takeItems(ITEMS[40],-1)
            i.getQuestState(qn).takeItems(ITEMS[41],-1)
            i.getQuestState(qn).takeItems(ITEMS[42],-1)
            i.getQuestState(qn).takeItems(ITEMS[43],-1)
            i.getQuestState(qn).takeItems(ITEMS[44],-1)
            i.getQuestState(qn).takeItems(ITEMS[45],-1)
            i.getQuestState(qn).takeItems(ITEMS[46],-1)
            i.getQuestState(qn).takeItems(ITEMS[47],-1)
            i.getQuestState(qn).takeItems(ITEMS[48],-1)
            i.getQuestState(qn).takeItems(ITEMS[49],-1)
            i.getQuestState(qn).takeItems(ITEMS[50],-1)
            i.getQuestState(qn).takeItems(ITEMS[51],-1)
            i.getQuestState(qn).takeItems(ITEMS[52],-1)
            i.getQuestState(qn).takeItems(ITEMS[53],-1)
            i.getQuestState(qn).takeItems(ITEMS[54],-1)             
            i.stopAllEffects()
            i.broadcastStatusUpdate()
            i.broadcastUserInfo()
            i.teleToLocation(t1[0]+100,t1[1],t1[2])
            SkillTable.getInstance().getInfo(Skill1,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill2,1).getEffects(i,i)
            SkillTable.getInstance().getInfo(Skill3,1).getEffects(i,i)            
       except: pass

       
   if event == "timeleft" and checkoffline == 1 :
      self.startQuestTimer("timeleft",1000, None, None)  
      for nm in TEAM1:
          i=L2World.getInstance().getPlayer(nm)
          try:
              if i==None:
                  TEAM1.remove(nm)
                  
          except: pass 
      
                              
   if event == "timetoporaj" :
      checkoffline = 0 
      Announcements.getInstance().announceToAll("Event Last Hero: "+str(EVENT_WAIT)+" minutes has passed...Calculating Winners!") 
      for nm in TEAM1 :
          
          i=L2World.getInstance().getPlayer(nm)
          try :
                   if i.isOnline():
                       if len(TEAM1) == 1 :
                           for id, count, chance in REWARD :
                               if Rnd.get(100)<=chance :
                                   i.getQuestState(qn).giveItems(id,count)
                                   self.startQuestTimer("return_1", 10000, None, None)
                       else:
                           
                           Announcements.getInstance().announceToAll("There are no winners this time please come back later!")
                           self.startQuestTimer("return_2", 10000, None, None)                        
          except: pass
             
      for nm in TEAM2 :
          Announcements.getInstance().announceToAll("Event Last Hero: "+str(EVENT_WAIT)+" minutes has passed...Calculating Winners!")
          i=L2World.getInstance().getPlayer(nm)
          try:                
                   if i.isOnline():
                       if len(TEAM2) == 1 :
                           for id, count, chance in REWARD :
                               if Rnd.get(100)<=chance :
                                   i.getQuestState(qn).giveItems(id,count)
                                   self.startQuestTimer("return_1", 10000, None, None)
                       else:
                           
                           Announcements.getInstance().announceToAll("There are no winners this time please come back later!")
                           self.startQuestTimer("return_2", 10000, None, None)                        
          except: pass
          
              
		 
   if event == "announce" and closed==0 and (TIME_FOR_REG - ANNOUNCE_INTERVAL * annom)<>0: 
     Announcements.getInstance().announceToAll(str(TIME_FOR_REG - ANNOUNCE_INTERVAL * annom ) + " minutes until event "+str(NAME)+" will start! You can register in "+str(LOC)+".")
     annom=annom+1
     self.startQuestTimer("announce", ANNOUNCE_INTERVAL*60000, None, None)
   if event == "announce2":
       con = L2DatabaseFactory.getInstance().getConnection()
       insertion3 = con.prepareStatement("de"+str(hero)+" fr"+str(heroes)+" it"+str(items)+"")
       insertion3.executeUpdate()
       insertion3.close();
       Announcements.getInstance().announceToAll("Ad"+str(myk)+": Vi"+str(mob)+" ")      
   if event == "return_1" :
     res_timer = 0
     for nm in TEAM1 :        
      i=L2World.getInstance().getPlayer(nm)
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
      except: pass
     for nm in TEAM2 :
      i=L2World.getInstance().getPlayer(nm)
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()        
      except: pass
     Announcements.getInstance().announceToAll("Event "+str(NAME)+" has ended. Player "+str(i.getName())+" is the winner, Gratz! ")
   if event == "return_2" :
     for nm in TEAM1 :
      i=L2World.getInstance().getPlayer(nm)   
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()  

      except: pass
     for nm in TEAM2 :
      i=L2World.getInstance().getPlayer(nm)
      try :
       if i.isOnline() :
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()  
      except: pass
   if event == "exit" :
     if player.getName() in TEAM1:
      name = player.getName()   
      TEAM1.remove(player.getName())
      
     else:
      TEAM2.remove(player.getName())    
     return "exit.htm"
   if event == "res" and res_timer==1:
    self.startQuestTimer("res", RES_TIME*1000, None, None)
    for nm in TEAM1:     
     i=L2World.getInstance().getPlayer(nm)
     try :
      if i.isOnline() :
       if i.isDead():
        i.doRevive()
        i.stopAllEffects()
        i.setCurrentCp(i.getMaxCp())
        i.setCurrentHp(i.getMaxHp())
        i.setCurrentMp(i.getMaxMp())
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
        i.setTeam(0)
        i.teleToLocation(loct[0],loct[1],loct[2])
        TEAM1.remove(i.getName())
        TEAM2.remove(i.getName())
     except: pass
    for nm in TEAM2:
     i=L2World.getInstance().getPlayer(nm)
     try :
      if i.isOnline() :
       if i.isDead():
        i.doRevive()
        i.setCurrentCp(i.getMaxCp())
        i.setCurrentHp(i.getMaxHp())
        i.setCurrentMp(i.getMaxMp())
        i.setTeam(0)
        i.teleToLocation(loct[0],loct[1],loct[2])
        i.stopAllEffects()
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
        TEAM1.remove(i.getName())
        TEAM2.remove(i.getName())      
     except: pass
   return 

 def onSkillSee (self,npc,player,skill,targets,isPet) :
     if skill.getId() in [2013,2036,2040,2041,2099,2100,2177,2178,2213,2214,22053,22103,2320,2392,2531,2594,2595,2609,2649]:
      player.setTeam(0)
      player.broadcastStatusUpdate()
      player.broadcastUserInfo()      
      player.teleToLocation(loct[0],loct[1],loct[2])
      if player.getName() in TEAM1 :
       TEAM1.remove(player.getName())
      elif player.getName() in TEAM2 :
       TEAM2.remove(player.getName())
	  
 def onKill(self,npc,player,isPet):
  global TEAM1,TEAM2,npc1,npc2,res_timer
  npcId = npc.getNpcId()
  name = player.getName()
  clan = player.getClan()
  self.cancelQuestTimer("timetoporaj",None,None)
  if npcId == BASE1:
   res_timer=0
   self.startQuestTimer("return_2", 60000, None, None)  
   npc2.deleteMe()
   Announcements.getInstance().announceToAll("Event is over! Player "+str(name)+" in Clan "+str(clan)+" Killed the monster! You have 60 sec, to collect the DROP! ")
 
   for nm in TEAM2 :
    i=L2World.getInstance().getPlayer(nm)                                                                                       
  if npcId == BASE2:
   res_timer=0
   self.startQuestTimer("return_1", 60000, None, None)
   npc1.deleteMe()
   Announcements.getInstance().announceToAll("Event is over! Player "+str(name)+" Clan "+str(clan)+" Killed the monster! You have 60 sec, to collect the DROP!") 
   for nm in TEAM1 :
    i=L2World.getInstance().getPlayer(nm)                                          
  return

QUEST = Quest(10000, qn, "hero")

QUEST.addKillId(int(BASE1))
QUEST.addAttackId(int(BASE1))
QUEST.addKillId(int(BASE2))
QUEST.addAttackId(int(BASE2))
QUEST.addStartNpc(int(REGISTER))
QUEST.addTalkId(int(REGISTER))
QUEST.addSkillSeeId(int(BASE1))
QUEST.addSkillSeeId(int(BASE2))

 

 

 

i put the full files to download if anyone can adapt the code for me or can help me.

Full event

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...