Jump to content
  • 0

[HELP]CApture the base event


Question

Posted

Guys katevasa x8es ena event capture the base apo to maxcheaters to evala ola ok kai to ekana na arxizi me 2 atoma

alla otan dilonoune kai perimenoune dn arxizi leei registration canceled due lack of player kai kati allo pos ginete na to vazo ayto ka8e dio ores px san to tvt tis l2j edo einai to __init__.py please help. :-\

 

import sys

from com.l2jserver.gameserver.model.quest import State

from com.l2jserver.gameserver.model.quest import QuestState

from com.l2jserver.gameserver.datatables import DoorTable

from com.l2jserver.gameserver.datatables import SkillTable

from com.l2jserver.gameserver.model import L2Skill

from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest

from com.l2jserver.gameserver import Announcements

from com.l2jserver import L2DatabaseFactory

from com.l2jserver.gameserver.ai import CtrlIntention

from com.l2jserver.util import Rnd

from java.lang import System

from com.l2jserver.gameserver.model import L2World

qn = "5556_Base"

closed=1

res_timer=0

npc1=0

npc2=0

TEAM1 = []

TEAM2 = []

attacked = 0

annom = 1

NAME = "ZAHVAT BAZI"

LOC = "Goddard"

REGISTER = 55558

locr = [147712,-55520,-2733]

PENI = 57

PENI_KOL = 100000000

LEVEL = 76

AFTER_RESTART = 5

TIME_FOR_WAIT = 350

TIME_FOR_REG = 3

ANNOUNCE_INTERVAL = 2

YCH_MIN = 3

YCH_MAX = 20

REWARD =[[9552,3,40],[9553,3,40],[9554,3,40],[9555,3,40],[9556,3,40],[9557,3,40]]

t1 =[81431,-16025,-1855]

t2 =[85162,-16759,-1829]

BASE1 = 55561

BASE2 = 55562

com1 = "Dark power"

com2 = "Light power"

RES_TIME = 8

 

 

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)

  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):

            TEAM2.append(player.getName())

            return "reg.htm"

          else:

            TEAM1.append(player.getName())

            return "reg.htm"

        else:

          st.exitQuest(1)

          return "nopeni.htm"

        else:

          if len(TEAM1)>len(TEAM2):

            TEAM2.append(player.getName())

            return "reg.htm"

          else:

            TEAM1.append(player.getName())

            return "reg.htm"

      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

  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("announce", ANNOUNCE_INTERVAL*60000, None, None)

    Announcements.getInstance().announceToAll("Opened registration for "+str(NAME)+" event! You can register in "+str(LOC)+".")

  if event == "close":

    res_timer = 1

    self.startQuestTimer("res", RES_TIME*1000, None, None)

    self.startQuestTimer("open", TIME_FOR_WAIT*60000, None, None)

    for nm in TEAM1:

    i=L2World.getInstance().getPlayer(nm)

    if i<>None:

      if not i.isOnline() or i.isInOlympiadMode():

      TEAM1.remove(nm)

    else:

      TEAM1.remove(nm)

    for nm in TEAM2:

    i=L2World.getInstance().getPlayer(nm)

    if i<>None:

      if not i.isOnline() or i.isInOlympiadMode():

      TEAM2.remove(nm)

    else:

      TEAM2.remove(nm)

    while abs(len(TEAM1)-len(TEAM2))>1:

    if len(TEAM1)>len(TEAM2):

      self.saveGlobalQuestVar(str(TEAM1[0].getObjectId()), "team2")

      TEAM2.append(TEAM1[0])

      TEAM1.remove(TEAM1[0])

    else:

      self.saveGlobalQuestVar(str(TEAM2[0].getObjectId()), "team1")

      TEAM1.append(TEAM2[0])

      TEAM2.remove(TEAM2[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:

      closed=1

      Announcements.getInstance().announceToAll("Event "+str(NAME)+" has started!")

      npc.deleteMe()

      npc1=self.addSpawn(BASE1,t1[0],t1[1],t1[2],30000,False,0)

      npc2=self.addSpawn(BASE2,t2[0],t2[1],t2[2],30000,False,0)

      for nm in TEAM1 :

      i=L2World.getInstance().getPlayer(nm)

      if i<>None:

        if i.isOnline() :

        i.stopAllEffects()

        i.setTeam(2)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

        i.teleToLocation(t1[0]+100,t1[1],t1[2])

      for nm in TEAM2 :

      i=L2World.getInstance().getPlayer(nm)

      if i<>None:

        if i.isOnline() :

        i.stopAllEffects()

        i.setTeam(1)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

        i.teleToLocation(t2[0]+100,t2[1],t2[2])

  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)+". There are "+str(len(TEAM1))+" Dark warriors and "+str(len(TEAM2))+" Heroes of Light.")

    annom=annom+1

    self.startQuestTimer("announce", ANNOUNCE_INTERVAL*60000, None, None)

  if event == "return_1" :

    res_timer = 0

    for nm in TEAM1 :

      i=L2World.getInstance().getPlayer(nm)

      if i<>None:

      if i.isOnline() :

        i.teleToLocation(locr[0],locr[1],locr[2])

        i.setTeam(0)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

    for nm in TEAM2 :

      i=L2World.getInstance().getPlayer(nm)

      if i<>None:

      if i.isOnline() :

        i.teleToLocation(locr[0],locr[1],locr[2])

        i.setTeam(0)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

    Announcements.getInstance().announceToAll("Event "+str(NAME)+" has ended. "+str(com1)+" win!")

  if event == "return_2" :

    res_timer = 0

    for nm in TEAM1 :

      i=L2World.getInstance().getPlayer(nm)

      if i<>None:

      if i.isOnline() :

        i.teleToLocation(locr[0],locr[1],locr[2])

        i.setTeam(0)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

    for nm in TEAM2 :

      i=L2World.getInstance().getPlayer(nm)

      if i<>None:

      if i.isOnline() :

        i.teleToLocation(locr[0],locr[1],locr[2])

        i.setTeam(0)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

    Announcements.getInstance().announceToAll("Event "+str(NAME)+" has ended. "+str(com2)+" win!")

  if event == "exit" :

    if player.getName() in TEAM1:

      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)

    if i<>None:

      if i.isOnline() :

      if i.isDead():

        i.doRevive()

        i.setCurrentCp(i.getMaxCp())

        i.setCurrentHp(i.getMaxHp())

        i.setCurrentMp(i.getMaxMp())

        i.stopAllEffects()

        i.setTeam(0)

        i.setTeam(2)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

        i.teleToLocation(t1[0],t1[1],t1[2])

    for nm in TEAM2:

    i=L2World.getInstance().getPlayer(nm)

    if i<>None:

      if i.isOnline() :

      if i.isDead():

        i.doRevive()

        i.setCurrentCp(i.getMaxCp())

        i.setCurrentHp(i.getMaxHp())

        i.setCurrentMp(i.getMaxMp())

        i.stopAllEffects()

        i.setTeam(0)

        i.setTeam(1)

        i.broadcastStatusUpdate()

        i.broadcastUserInfo()

        i.teleToLocation(t2[0],t2[1],t2[2])

  return

 

def onAttack (self,npc,player,damage,isPet,npcId):

  npcId = npc.getNpcId()

  if npcId == BASE2 and player.getName() not in TEAM1 :

    #player.reduceCurrentHp(99999,player) 

      player.teleToLocation(85359,-17786,-1833)

  if npcId == BASE1 and player.getName() not in TEAM2 :

    #player.reduceCurrentHp(99999,player) 

      player.teleToLocation(80153,-16204,-1819)

  return 

 

def onSkillSee (self,npc,player,skill,targets,isPet) :

    if player.getTarget() == npc and skill.getId() in [1218,1015,1258,1011,1401,58,1217,329]:

      player.setTeam(0)

      player.broadcastStatusUpdate()

      player.broadcastUserInfo()     

      player.teleToLocation(locr[0],locr[1],locr[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()

  if npcId == BASE1:

  res_timer=0

  self.startQuestTimer("return_2", 10000, None, None) 

  npc2.deleteMe()

  for nm in TEAM2 :

    i=L2World.getInstance().getPlayer(nm)

    if i<>None:

    if i.isOnline() :

      for id, count, chance in REWARD :

      if Rnd.get(100)<=chance :

        i.getQuestState(qn).giveItems(8570,12)

  if npcId == BASE2:

  res_timer=0

  self.startQuestTimer("return_1", 10000, None, None)

  npc1.deleteMe()

  for nm in TEAM1 :

    i=L2World.getInstance().getPlayer(nm)

    if i<>None:

    if i.isOnline() :

      for id, count, chance in REWARD :

      if Rnd.get(100)<=chance :

        i.getQuestState(qn).giveItems(8570,12)

  return

 

QUEST = Quest(5556, qn, "Base")

 

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))

8 answers to this question

Recommended Posts

  • 0
Posted

bumb

 

bump μπορείς να κάνεις το topic σου κάθε 24ώρες. Πρόσεχε καλύτερα την επόμενη φορά.

  • 0
Posted

Βασικα οταν επιλέξεις να ειναι για 2 ατομα >> 2 ατομα απο την κα8ε πλευρα, αν 8ελεις να το δοκιμασεις βαλε 1 ατομο (=1) στην καθε πλευρά.

Αυτο τουλάχιστον λειει ο κώδικας...

  • 0
Posted

vrika ti ftaiei to sql arxio dn perniotan k to perasa xirokinita alla dn kaneis pos mporo na to kano na pari to sql

 

INSERT INTO `custom_npc` (`id`, `idTemplate`, `name`, `serverSideName`, `title`, `serverSideTitle`, `class`, `collision_radius`, `collision_height`, `level`, `sex`, `type`, `attackrange`, `hp`, `mp`, `hpreg`, `mpreg`, `str`, `con`, `dex`, `int`, `wit`, `men`, `exp`, `sp`, `patk`, `pdef`, `matk`, `mdef`, `atkspd`, `aggro`, `matkspd`, `rhand`, `lhand`, `armor`, `enchant`, `walkspd`, `runspd`, `isUndead`, `absorb_level`, `absorb_type`, `drop_herbs`) VALUES

('55561', 13001, 'Power of Dark', 1, 'Core', 1, 'NPC.heart_of_warding', '42.50', '75.00', '85', 'female', 'L2GrandBoss', 0, '200000', '3793', '0.00', '0.00', '60', '57', '73', '76', '70', '80', '2374400', '1196456', '0', '5000', '0', '6000', '0', '0', '0', '0', '0', '0', 0, '0', '0', 0, '0', 'FULL_PARTY', 'false'),

('55562', 13001, 'Power of Ligth', 1, 'Core', 1, 'NPC.heart_of_warding', '42.50', '75.00', '85', 'female', 'L2GrandBoss', 0, '200000', '3793', '0.00', '0.00', '60', '57', '73', '76', '70', '80', '2374400', '1196456', '0', '5000', '0', '6000', '0', '0', '0', '0', '0', '0', 0, '0', '0', 0, '0', 'FULL_PARTY', 'false'),

('55558', 32130, 'Atome', 1, 'Capture The Base', 1, 'LineageMonster3.king_of_cat', '6.00', '16.01', '80', 'male', 'L2Npc', 40, '6053', '2143', '13.43', '3.09', '40', '43', '30', '21', '20', '25', '0', '0', '2646', '633', '2006', '593', '278', '0', '333', '0', '0', '0', 0, '52', '198', 0, '0', 'LAST_HIT', 'false');

  • 0
Posted

Το αρχείο .sql το περασες? πως να βοηθησουμε αν δεν ξερουμε σε ποιο βημα εισαι?

Ρωτας συνεχως πραγματα που παρουσιάζουν προβληματα απο διαφορετικα σημεια του κώδικα.

  • 0
Posted

akou ta perasa xirokinita ta sql epidi dn teriazoune sta teleutea dn exo absorb lvl kai tetia exo targetable sto navicat epidi einai l2 j to sql arxi custom_npc alla dn ksero ti ftaiei kai otan kanoun register sto npc olo akironete to event logo players grafi kai meta ama o pektis skoto8i etsi genika ekso ton emfanizi sto tvt alla xoris ta npc p exei mesa to event sto meros dn exei tpt katalaves ? kai dn ksero ti ftaei

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...