Jump to content

heladito92

Membro
  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

3 Normal

About heladito92

  • Rank
    ForeverAlone
  • Birthday 05/13/2001
  1. alguien me podria ayudar con este evento? lo agregue y me tira error en LastMan.java if (p.getKarma() > 0) { - p.sendPacket(new CreatureSay(1, Say2.PARTY, "LMS", "You cant not register because exceded the max players registered limit: "+ MaxPlayers + " players.")); - if (p.isInArenaEvent()) - if (EvtArenaManager.getInstance().isRegistered(p)) esas lineas dan error. LINK EVENTO:
  2. gracias! entonces voy a agregar ese y luego este :)
  3. so, debo crear primero el evento lastman y luego agregar el codigo de jdesire y solo cambiar los importes por l2jfrozen?
  4. Alguém me ajuda a adaptar este evento a última revolução congelada? por favor # -*- coding: cp1251 -*- import sys from com.l2emu.gameserver.model.quest import State from com.l2emu.gameserver.model.quest import QuestState from com.l2emu.gameserver.datatables import DoorTable from com.l2emu.gameserver.datatables import SkillTable from com.l2emu.gameserver.model.quest.jython import QuestJython as JQuest from com.l2emu.gameserver import Announcements from com.l2emu import L2DatabaseFactory from com.l2emu.gameserver.ai import CtrlIntention from com.l2emu.util import Rnd from java.lang import System from com.l2emu.gameserver.model import L2World from com.l2emu.gameserver.model.entity.events import TvT from com.l2emu.gameserver.handler.voicedcommandhandlers import castle from com.l2emu.gameserver.model.entity import Castle from com.l2emu.gameserver.datatables import ClanTable from com.l2emu import L2DatabaseFactory from com.l2emu import * from com.l2emu.gameserver.network.serverpackets import NpcSay qn = "5557_Base" # ======================================= # НЕ ТРОГАЕМ # ======================================= closed=1 res_timer=0 checkoffline = 0 npc1=0 npc2=0 TEAM1 = [] TEAM2 = [] attacked = 0 annom = 1 TEAM1DAMAGE=0 TEAM2DAMAGE=0 t2 =[-48923,248266,-9991] t3 =[-48923,248266,-9991] t4 =[-48923,248266,-9991] BASE1 = 31520 BASE2 = 31520 com1 = "NONE" com2 = "NONE" RES_TIME = 1 PENI = 0 PENI_KOL = 0 X_MIN = -251431 X_MAX = -251431 Y_MIN = 218088 Y_MAX = 218088 # ======================================= # CONFIG # ======================================= NAME = "Last Hero" # Название (только английские символы) LOC = "Giran" # Место, где вы поставили регистрирующего НПЦ. REGISTER = 32580 # Регистрирующий нпц. НЕ ЗАБЫВАЕМ ДЕЛАТЬ ЕГО БЕССМЕРТНЫМ. locr = [83266,148393,-3405] # Соответственно координаты, где будет появляться НПЦ loct = [82850,148650,-3469] # Координаты для возвращение команды/игрока после окончание евента/выбывание из евента. LEVEL = 80 # Минимальный уровень, на котором игрок сможет принять участие в ивенте. AFTER_RESTART = 60 # Время, которое пройдёт от запуска сервера(перезагрузки скрипта) до начала ивента. TIME_FOR_WAIT = 60 # Время между ивентами в минутах TIME_FOR_REG = 20 # Время на регистрацию в минутах ANNOUNCE_INTERVAL = 2 # Как часто аннонсить о регистрации на ивент в минутах. EVENT_TIME = 10 #Время длительности евента.в минутах. YCH_MIN = 2 # Минимальное количество участников в команде YCH_MAX = 200 # Максимальное количество участников в команде REWARD =[[53,5,100]] # Список наград. Выдаётся каждому участнику. Формат записи: [[itemId1,count1,chance1],[itemId2,count2,chanceN],...[itemIdN,countN,chanceN]] t1 =[-79822,-52155,-11492] # Место телепорта команды ( x y z ) EVENT_WAIT = 60 #Время которое вы даете на подготовку к евенту --- важно! => это число должно совпадать со скилами в дата паке(по мануалу), время в секундах. ITEMS = [736,737,1538,1829,1830,5858,5859,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,9156,9647,9717,10129,10130,10149,16050,13129,13258,13731,13732,13733,13734,13735,13736,13637,13738,13739] #Запрещенные вещи на евенте. I.E: [ID,ID1,ID2,...,ID100] Skill1 = 2344 #Навык который дается при телепортации на евент, ставим ИД после того как прочитали гайд. Skill2 = 394 #Навык который дается при телепортации на евент, ставим ИД после того как прочитали гайд. Skill3 = 392 #Навык который дается при телепортации на евент, ставим ИД после того как прочитали гайд. #Код который написан ниже не должен никогда изменятся, иначе вы лишаетесь тех. поддержки, по всем вопросом обращайтесь #на форум л2-скрипт.ру или по срочным вопросам по асе - 270-275-947 Спасибо что выбрали нас! 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): TEAM1.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): TEAM1.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,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("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",10000, 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.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 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",10000, 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 == "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: 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(5557, 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))
  5. ajuda por favor! Alguém poderia se adaptar para a última revisão do jfrozen? por favor por favor!! ### Eclipse Workspace Patch 1.0 #P L2jDesire_GameServer Index: head-src/com/l2jdesire/gameserver/datatables/xml/ZoneData.java =================================================================== --- head-src/com/l2jdesire/gameserver/datatables/xml/ZoneData.java (revision 3) +++ head-src/com/l2jdesire/gameserver/datatables/xml/ZoneData.java (working copy) @@ -50,6 +50,7 @@ import com.l2jdesire.gameserver.model.zone.type.L2CastleTeleportZone; import com.l2jdesire.gameserver.model.zone.type.L2CastleZone; import com.l2jdesire.gameserver.model.zone.type.L2ClanHallZone; +import com.l2jdesire.gameserver.model.zone.type.L2ClanWarZone; import com.l2jdesire.gameserver.model.zone.type.L2CustomZone; import com.l2jdesire.gameserver.model.zone.type.L2DamageZone; import com.l2jdesire.gameserver.model.zone.type.L2DerbyTrackZone; @@ -71,40 +72,39 @@ { temp = new L2CustomZone(zoneId); } - else if(zoneType.equals("SwampZone")) + else if (zoneType.equals("SwampZone")) { temp = new L2SwampZone(zoneId); } - + else if (zoneType.equals("FlagZone")) + { + temp = new L2ClanWarZone(zoneId); + } + // Check for unknown type - if(temp == null) + if (temp == null) { _log.warning("ZoneData: No such zone type: " + zoneType); continue; } - + zoneType = null; - - //get the zone shape from file if any + // get the zone shape from file if any + int[][] coords = null; int[] point; FastList<int[]> rs = FastList.newInstance(); Index: head-src/com/l2jdesire/gameserver/model/entity/event/ClanWar.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/entity/event/ClanWar.java (revision 0) +++ head-src/com/l2jdesire/gameserver/model/entity/event/ClanWar.java (working copy) @@ -0,0 +1,305 @@ +package com.l2jdesire.gameserver.model.entity.event; + +import javolution.util.FastList; + +import com.l2jdesire.Config; +import com.l2jdesire.gameserver.datatables.sql.NpcTable; +import com.l2jdesire.gameserver.datatables.sql.SpawnTable; +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.Announcements; +import com.l2jdesire.gameserver.model.spawn.L2Spawn; +import com.l2jdesire.gameserver.templates.L2NpcTemplate; +import com.l2jdesire.util.random.Rnd; + +/** + * This class ... + * @version $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ + */ +public class ClanWar implements Runnable +{ + public static FastList<L2PcInstance> _warplayers = new FastList<L2PcInstance>(); + public static L2Spawn _npcSpawn; + public static boolean ativowar = false; + public static boolean registrowar = false; + + @Override + public void run() + { + if (ativowar == true) + { + return; + } + eventowar(); + + } + + public static void eventowar() + { + NpcSpawnClanWarMan(); + ativowar = true; + registrowar = true; + Announcements.getInstance().gameAnnouncetoClanWar("ClanWar Started"); + Announcements.getInstance().gameAnnouncetoClanWar("5 minute(s) till registration close"); + Announcements.getInstance().gameAnnouncetoClanWar("Use to .joincw or .leavecw or go to giran"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("4 minute(s) till registration close"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("3 minute(s) till registration close"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("2 minute(s) till registration close"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("1 minute(s) till registration close"); + wait(1); + unspawnNpcClanWarMan(); + if (_warplayers.size() < 3) + { + for (L2PcInstance pp : _warplayers) + { + pp.inWARCLANZONE = false; + } + Announcements.getInstance().gameAnnouncetoClanWar("Minimum 3 participants for the event to happen"); + clearClanWar(); + return; + } + registrowar = false; + teleportClanWar(false); + setUserData(); + prepare(); + Announcements.getInstance().gameAnnouncetoClanWar("You have 45 seconds to get prepared"); + waitSecs(45); + start(); + Announcements.getInstance().gameAnnouncetoClanWar("8 minute(s) till event ClanWar finish!"); + wait(3); + Announcements.getInstance().gameAnnouncetoClanWar("5 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("4 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("3 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("2 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("1 minute(s) till event ClanWar finish!"); + wait(1); + ativowar = false; + Announcements.getInstance().gameAnnouncetoClanWar("The event ClanWar ended congratulations!"); + waitSecs(1); + teleportClanWar(true); + clearClanWar(); + } + + public static boolean is_startedwar() + { + return ativowar; + } + + public static void teleportClanWar(boolean back) + { + if (!back) + { + for (L2PcInstance p : _warplayers) + { + p.restoreCP(); + p.restoreHPMP(); + p.teleToLocation(45527 + Rnd.get(3001) - 700, 49562 + Rnd.get(1501) - 500, -3071); + p.sendMessage("You have been moved to coliseum"); + } + } + else + { + for (L2PcInstance p : _warplayers) + { + p.getAppearance().setNameColor(p._originalcolorclanwar); + p.setTitle(p._originaltitleclanwar); + p.inWARCLANZONE = false; + _warplayers.remove(p); + p.teleToLocation(82813, 148344, -3471); + p.sendMessage("You have been moved to giran"); + } + } + } + + public static void registerClanWar(L2PcInstance p) + { + + if (_warplayers.contains(p)) + { + p.sendMessage("You have already register"); + return; + } + if (p.getClan() == null) + { + p.sendMessage("You don't have clan"); + return; + } + if (registrowar == false) + { + p.sendMessage("Can't register now"); + return; + } + if (p.isInOlympiadMode()) + { + p.sendMessage("You can't register while you have register for olympiad match"); + return; + } + if (p.isInFunEvent()) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (p.isInArenaEvent()) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (p.inLASTMAN == true) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (EvtArenaManager.getInstance().isRegistered(p)) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (p.getKarma() > 0) + { + p.sendMessage("You can not register pk"); + return; + } + _warplayers.add(p); + p.sendMessage("You successfully registered for the event"); + p.inWARCLANZONE = true; + } + + public static void unregisterClanWar(L2PcInstance p) + { + if (!_warplayers.contains(p)) + { + p.sendMessage("You have already unregister"); + return; + } + + if (registrowar == false) + { + p.sendMessage("You can't unregister while match is about to begin"); + return; + } + + _warplayers.remove(p); + p.sendMessage("Succesfully unregistered"); + p.inWARCLANZONE = false; + } + + public static void prepare() + { + for (L2PcInstance p : _warplayers) + { + p.setIsInvul(true); + p.setIsRooted(true); + p.sendMessage("You have 45 seconds to get prepared"); + } + } + + public static void start() + { + + for (L2PcInstance p : _warplayers) + { + p.stopRooting(null); + p.setIsInvul(false); + p.sendMessage("Go go go,start fighting"); + } + } + + private static void NpcSpawnClanWarMan() + { + L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(Config.LASTMAN_ID_NPC);// ID do mob + try + { + _npcSpawn = new L2Spawn(tmpl); + + _npcSpawn.setLocx(82640); // loc x + _npcSpawn.setLocy(148519); // loc y + _npcSpawn.setLocz(-3472); // loc z + _npcSpawn.setAmount(1); + _npcSpawn.setHeading(0); + _npcSpawn.setRespawnDelay(1); + + SpawnTable.getInstance().addNewSpawn(_npcSpawn, false); + + _npcSpawn.init(); + _npcSpawn.getLastSpawn().setTitle("ClanWar"); + _npcSpawn.getLastSpawn().isAggressive(); + _npcSpawn.getLastSpawn().decayMe(); + _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ()); + } + catch (Exception e) + { + System.out.println("Erro no evento"); + } + } + + private static void unspawnNpcClanWarMan() + { + if (_npcSpawn == null || _npcSpawn.getLastSpawn() == null) + return; + + _npcSpawn.getLastSpawn().deleteMe(); + _npcSpawn.stopRespawn(); + SpawnTable.getInstance().deleteSpawn(_npcSpawn, true); + } + + public static void clearClanWar() + { + for (L2PcInstance p : _warplayers) + { + p.inWARCLANZONE = false; + } + _warplayers.clear(); + ativowar = false; + registrowar = false; + } + + public static void waitSecs(int i) + { + try + { + Thread.sleep(i * 1000); + } + catch (InterruptedException ie) + { + ie.printStackTrace(); + } + } + + public static void wait(int i) + { + try + { + Thread.sleep(i * 60000); + } + catch (InterruptedException ie) + { + ie.printStackTrace(); + } + } + + public static void setUserData() + { + final FastList<L2PcInstance> players = getPlayers(); + + for (final L2PcInstance player : players) + { + player._originalcolorclanwar = player.getAppearance().getNameColor(); + player._originaltitleclanwar = player.getTitle(); + player.getAppearance().setNameColor(Config.CLANWARANEMCOLOR); + player.setTitle("ClanWar Event"); + player.setKarma(0); + player.broadcastUserInfo(); + } + } + + protected synchronized static FastList<L2PcInstance> getPlayers() + { + return _warplayers; + } + +} Index: head-src/com/l2jdesire/gameserver/handler/AdminCommandHandler.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/AdminCommandHandler.java (revision 3) +++ head-src/com/l2jdesire/gameserver/handler/AdminCommandHandler.java (working copy) @@ -34,6 +34,7 @@ import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminBuffs; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminCTFEngine; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminClanFull; +import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminClanWar; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminLastMan; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminVip; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminCache; @@ -129,6 +130,7 @@ registerAdminCommandHandler(new AdminKill()); registerAdminCommandHandler(new AdminTarget()); registerAdminCommandHandler(new AdminShop()); + registerAdminCommandHandler(new AdminClanWar()); registerAdminCommandHandler(new AdminVip()); registerAdminCommandHandler(new AdminCTFEngine()); registerAdminCommandHandler(new AdminVIPEngine()); Index: head-src/com/l2jdesire/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/actor/instance/L2PcInstance.java (revision 3) +++ head-src/com/l2jdesire/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -141,6 +141,7 @@ import com.l2jdesire.gameserver.model.entity.Duel; import com.l2jdesire.gameserver.model.entity.L2Rebirth; import com.l2jdesire.gameserver.model.entity.event.CTF; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; import com.l2jdesire.gameserver.model.entity.event.DM; import com.l2jdesire.gameserver.model.entity.event.EvtArenaManager; import com.l2jdesire.gameserver.model.entity.event.L2Event; @@ -719,7 +720,7 @@ /** The _client. */ private L2GameClient _client; - + /** The _account name. */ private String _accountName; @@ -2019,7 +2020,7 @@ public void logout(boolean kicked) { // prevent from player disconnect when in Event - if(isInLastMan()) + if (isInLastMan()) { } if (atEvent) @@ -5661,12 +5662,12 @@ { if (_client != null) { - if(isInLastMan()) + if (isInLastMan()) { } _client.close(new LeaveWorld()); setClient(null); - + } } @@ -7303,6 +7304,22 @@ }, Config.TVT_REVIVE_DELAY); } } + else if (inWARCLANZONE) + { + if (ClanWar.ativowar || inWARCLANZONE == true) + { + sendMessage("You will be revived and teleported in 10 seconds!"); + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() + { + @Override + public void run() + { + teleToLocation(45527 + Rnd.get(3001) - 700, 49562 + Rnd.get(1501) - 500, -3071); + doRevive(); + } + }, 10000); + } + } else if (_inEventCTF) { if (CTF.is_teleport() || CTF.is_started()) @@ -7705,6 +7722,14 @@ return; } + if (isInsideClanwarZone() && targetPlayer.isInsideClanwarZone() && (getClan() != null) && (targetPlayer.getClan() != null) && (getClanId() != targetPlayer.getClanId())) + { + getInventory().addItem("Event", Config.CLANWAR_ITEM_ID, Config.CLANWAR_ITEM_QUANTIA, null, null); + sendMessage("You killed someone from an enemy clan."); + getClan().setRep***tionScore(getClan().getRep***tionScore() + Config.REPUTATION_QUANTITY_CLANWAR, true); + setKarma(0); + } + // Check if it's pvp if (checkIfPvP(target) && targetPlayer.getPvpFlag() != 0 || isInsideZone(ZONE_PVP) && targetPlayer.isInsideZone(ZONE_PVP)) { @@ -8210,7 +8235,7 @@ */ public void increasePkKillsAndKarma(int targLVL) { - if ((TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP)) + if ((TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP) || ClanWar.ativowar == true) return; int baseKarma = Config.KARMA_MIN_KARMA; @@ -19323,17 +19348,22 @@ { return inArenaEvent; } - + public boolean isInClanWarEvent() + { + return inWARCLANZONE; + } private int arenaDefeats; private int arenaWins; - //Arena + // Arena public boolean inLASTMAN = false; public boolean ForaLastMan = true; public int _originalColorTitle; + public int _originalcolorclanwar; + public String _originaltitleclanwar; public String _originaltitlelast; public static boolean revive = false; - + public boolean inWARCLANZONE = false; public boolean isInLastMan() Index: head-src/com/l2jdesire/gameserver/model/zone/type/L2ClanWarZone.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/zone/type/L2ClanWarZone.java (revision 0) +++ head-src/com/l2jdesire/gameserver/model/zone/type/L2ClanWarZone.java (working copy) @@ -0,0 +1,74 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.l2jdesire.gameserver.model.zone.type; + +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.zone.L2ZoneType; +import com.l2jdesire.gameserver.model.L2Character; +import com.l2jdesire.gameserver.thread.ThreadPoolManager; +import com.l2jdesire.util.random.Rnd; + +public class L2ClanWarZone extends L2ZoneType +{ + + /** + * @param id + */ + public L2ClanWarZone(int id) + { + super(id); + } + + @Override + protected void onEnter(L2Character character) + { + if (ClanWar.ativowar == true) + { + if (character instanceof L2PcInstance) + { + if (((L2PcInstance) character).getClan() != null && ((L2PcInstance) character).inWARCLANZONE == true) + { + ((L2PcInstance) character).setIsInsideClanwarZone(true); + ((L2PcInstance) character).sendMessage("You have entered a Clan War Zone. Prepare for fight."); + } + else + { + ((L2PcInstance) character).sendMessage("This is strict area for clan members ONLY. or not at the time of the event"); + ((L2PcInstance) character).teleToLocation(83302, 148125, -3408); + } + } + } + } + + @Override + protected void onExit(L2Character character) + { + if(((L2PcInstance) character).isInClanWarEvent()) + { + if(!((L2PcInstance) character).isDead()) + { + ThreadPoolManager.getInstance().scheduleGeneral(new BackToZone(character), 2000); + } + ((L2PcInstance) character).sendMessage("You can't cheat your way out of here. You must wait ClanWar time is over."); + } + if (character instanceof L2PcInstance) + { + ((L2PcInstance) character).setIsInsideClanwarZone(false); + } + } + + @Override + public void onDieInside(L2Character character) + { + + } + + @Override + public void onReviveInside(L2Character character) + { + onEnter(character); + } + + static class BackToZone implements Runnable + { + private L2PcInstance _activeChar; + + BackToZone(L2Character character) + { + _activeChar = (L2PcInstance) character; + } + + @Override + public void run() + { + _activeChar.teleToLocation(45819, 49359, -3066); // Elven Village + } +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/handler/admincommandhandlers/AdminClanWar.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/admincommandhandlers/AdminClanWar.java (revision 0) +++ head-src/com/l2jdesire/gameserver/handler/admincommandhandlers/AdminClanWar.java (working copy) @@ -0,0 +1,48 @@ +// Decompiled by DJ v3.11.11.95 Copyright 2009 Atanas Neshkov Date: 26/7/2011 21:21:40 +// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! +// Decompiler options: packimports(3) +// Source File Name: AdminClanFull.java + +package com.l2jdesire.gameserver.handler.admincommandhandlers; + +import com.l2jdesire.gameserver.handler.IAdminCommandHandler; +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.entity.event.LastMan; +import com.l2jdesire.gameserver.thread.ThreadPoolManager; + +public class AdminClanWar implements IAdminCommandHandler +{ + + public AdminClanWar() + { + } + + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + if (command.startsWith("admin_clanwar")) + { + try + { + ThreadPoolManager.getInstance().scheduleGeneral(new ClanWar(), 1); + + } + catch (Exception e) + { + activeChar.sendMessage("Usage: //clanwar"); + } + } + return true; + } + + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } + + private static final String ADMIN_COMMANDS[] = + { + "admin_clanwar" + }; + +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/network/L2GameClient.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/L2GameClient.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/L2GameClient.java (working copy) @@ -838,6 +838,15 @@ L2PcInstance player = L2GameClient.this.getActiveChar(); if (player != null) // this should only happen on connection loss { + if(player.inWARCLANZONE == true) + { + player.getAppearance().setNameColor(player._originalcolorclanwar); + player.setTitle(player._originaltitleclanwar); + com.l2jdesire.gameserver.model.entity.event.ClanWar._warplayers.remove(player); + player.inWARCLANZONE = false; + player.teleToLocation(82813, 148344, -3471); + player.setKarma(0); + } if(player.inLASTMAN == true) { player.getAppearance().setTitleColor(player._originalColorTitle); Index: head-src/com/l2jdesire/gameserver/GameServer.java =================================================================== --- head-src/com/l2jdesire/gameserver/GameServer.java (revision 3) +++ head-src/com/l2jdesire/gameserver/GameServer.java (working copy) @@ -574,14 +574,19 @@ else _log.info("# Auto LastMan System is Disabled #"); - System.gc(); if(Config.EVENT_BY_TIME_OF_DAY) InitialBossManager.getInstance().StartCalculationOfNextBossTime(); else _log.info("# Auto BossManager System is Disabled #"); - System.gc(); + + if(Config.CLANWAR_BY_TIME_OF_DAY) + InitialClanWar.getInstance().StartCalculationOfNextClanWarTime(); + else + _log.info("# Auto ClanWar System is Disabled #"); + + System.gc(); Util.printSection("Info"); _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch()); Index: head-src/com/l2jdesire/Config.java =================================================================== --- head-src/com/l2jdesire/Config.java (revision 3) +++ head-src/com/l2jdesire/Config.java (working copy) @@ -666,12 +666,20 @@ public static int FS_TIME_ATTACK; public static int FS_TIME_COOLDOWN; + public static int CLANWAR_ITEM_QUANTIA; + public static int CLANWAR_ITEM_ID; + public static int CLANWARANEMCOLOR; + public static int REPUTATION_QUANTITY_CLANWAR; public static int FS_TIME_ENTRY; public static int FS_TIME_WARMUP; public static int FS_PARTY_MEMBER_COUNT; public static boolean LASTMAN_BY_TIME_OF_DAY; public static String[] LASTMAN_INTERVAL_BY_TIME_OF_DAY; + + public static boolean CLANWAR_BY_TIME_OF_DAY; + public static String[] CLANWAR_INTERVAL_BY_TIME_OF_DAY; + public static boolean ALLOW_QUAKE_SYSTEM; public static boolean ENABLE_ANTI_PVP_FARM_MSG; @@ -790,6 +798,14 @@ ALLOW_GUARDS = Boolean.valueOf(otherSettings.getProperty("AllowGuards", "False")); EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("CancelLesserEffect", "True")); LASTMANCOLOR = Integer.decode("0x" + otherSettings.getProperty("LASTMANCOLOR", "00FF00")); + + CLANWARANEMCOLOR = Integer.decode("0x" + otherSettings.getProperty("NameColorClanWar", "00FF00")); + CLANWAR_ITEM_ID = Integer.parseInt(otherSettings.getProperty("ClanWarItemID", "57")); + CLANWAR_ITEM_QUANTIA = Integer.parseInt(otherSettings.getProperty("ClanWarItemQuantia", "80")); + REPUTATION_QUANTITY_CLANWAR = Integer.parseInt(otherSettings.getProperty("Rep***tionQuantia", "180")); + CLANWAR_BY_TIME_OF_DAY = Boolean.parseBoolean(otherSettings.getProperty("EnableClanWarSystem", "false")); + CLANWAR_INTERVAL_BY_TIME_OF_DAY = otherSettings.getProperty("ClanWarByTimeOfDay", "20:00").split(","); + WYVERN_SPEED = Integer.parseInt(otherSettings.getProperty("WyvernSpeed", "100")); LASTMAN_BY_TIME_OF_DAY = Boolean.parseBoolean(otherSettings.getProperty("EnableLastManSystem", "false")); LASTMAN_INTERVAL_BY_TIME_OF_DAY = otherSettings.getProperty("LastManByTimeOfDay", "20:00").split(","); Index: head-src/com/l2jdesire/gameserver/network/clientpackets/Logout.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/clientpackets/Logout.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/clientpackets/Logout.java (working copy) @@ -29,6 +29,7 @@ import com.l2jdesire.gameserver.network.L2GameClient; import com.l2jdesire.gameserver.network.SystemMessageId; import com.l2jdesire.gameserver.network.serverpackets.ActionFailed; +import com.l2jdesire.gameserver.network.serverpackets.RestartResponse; import com.l2jdesire.gameserver.network.serverpackets.SystemMessage; import com.l2jdesire.gameserver.taskmanager.AttackStanceTaskManager; @@ -56,6 +57,13 @@ return; } + if(player.inWARCLANZONE == true) + { + player.sendMessage("You cannot Logout while in registered in an Event."); + player.sendPacket(ActionFailed.STATIC_PACKET); + return; + } + if(player.inLASTMAN == true) { player.sendMessage("You cannot Logout while in registered in an Event."); @@ -63,6 +71,7 @@ return; } + if (player.isInFunEvent() && !player.isGM()) { player.sendMessage("You cannot Logout while in registered in an Event."); @@ -97,6 +106,16 @@ return; } + if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING)) + { + if(Config.DEBUG) + _log.fine("Player " + player.getName() + " tried to logout while fighting."); + + player.sendPacket(new SystemMessage(SystemMessageId.CANT_RESTART_WHILE_FIGHTING)); + sendPacket(RestartResponse.valueOf(false)); + return; + } + if (player.isInLastMan()) { player.sendMessage("You cannot Logout while is in Combat mode."); Index: head-src/com/l2jdesire/gameserver/handler/VoicedCommandHandler.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/VoicedCommandHandler.java (revision 3) +++ head-src/com/l2jdesire/gameserver/handler/VoicedCommandHandler.java (working copy) @@ -28,6 +28,7 @@ import com.l2jdesire.gameserver.handler.voicedcommandhandlers.AwayCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.BankingCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.CTFCmd; +import com.l2jdesire.gameserver.handler.voicedcommandhandlers.ClanWarvoice; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.DMCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.FarmPvpCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.OfflineShop; @@ -67,6 +68,7 @@ registerVoicedCommandHandler(new Voting()); registerVoicedCommandHandler(new eventlhe()); + registerVoicedCommandHandler(new ClanWarvoice()); if (Config.BANKING_SYSTEM_ENABLED) { Index: head-src/com/l2jdesire/gameserver/model/actor/instance/L2EngineEventInstance.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/actor/instance/L2EngineEventInstance.java (revision 0) +++ head-src/com/l2jdesire/gameserver/model/actor/instance/L2EngineEventInstance.java (working copy) @@ -0,0 +1,138 @@ +/* This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * http://www.gnu.org/copyleft/gpl.html + */ +package com.l2jdesire.gameserver.model.actor.instance; + +import com.l2jdesire.Config; +import com.l2jdesire.gameserver.ai.CtrlIntention; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.entity.event.LastMan; +import com.l2jdesire.gameserver.network.serverpackets.ActionFailed; +import com.l2jdesire.gameserver.network.serverpackets.MyTargetSelected; +import com.l2jdesire.gameserver.network.serverpackets.NpcHtmlMessage; +import com.l2jdesire.gameserver.network.serverpackets.ValidateLocation; +import com.l2jdesire.gameserver.templates.L2NpcTemplate; + +/** + * @author Axcel Kuhn + */ +public class L2EngineEventInstance extends L2FolkInstance + { + public L2EngineEventInstance(int objectId, L2NpcTemplate template) + { + super(objectId, template); + } + + @Override + public void onAction(L2PcInstance player) + { + if (!canTarget(player)) + return; + + player.setLastFolkNPC(this); + + // Check if the L2PcInstance already target the L2NpcInstance + if (this != player.getTarget()) + { + // Set the target of the L2PcInstance player + player.setTarget(this); + + // Send a Server->Client packet MyTargetSelected to the L2PcInstance player + MyTargetSelected my = new MyTargetSelected(getObjectId(), 0); + player.sendPacket(my); + my = null; + + // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client + player.sendPacket(new ValidateLocation(this)); + } + else + { + // Calculate the distance between the L2PcInstance and the L2NpcInstance + if (!canInteract(player)) + { + // Notify the L2PcInstance AI with AI_INTENTION_INTERACT + player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); + } + else + { + if(ClanWar.ativowar == true) + { + showMessageWindowClanWar(player); + } + if(LastMan.ativo == true) + { + showMessageWindow(player); + } + } + } + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet + player.sendPacket(ActionFailed.STATIC_PACKET); + } + + private void showMessageWindow(L2PcInstance player) + { + String filename = "data/html/mods/LastMan/start.htm"; + + NpcHtmlMessage html = new NpcHtmlMessage(1); + html.setFile(filename); + html.replace("%objectId%", String.valueOf(getObjectId())); + html.replace("%servername%", Config.ALT_Server_Name); + player.sendPacket(html); + filename = null; + html = null; + } + + private void showMessageWindowClanWar(L2PcInstance player) + { + String filename = "data/html/mods/ClanWar/start.htm"; + + NpcHtmlMessage html = new NpcHtmlMessage(1); + html.setFile(filename); + html.replace("%objectId%", String.valueOf(getObjectId())); + html.replace("%servername%", Config.ALT_Server_Name); + player.sendPacket(html); + filename = null; + html = null; + } + + + + + @Override + public void onBypassFeedback(L2PcInstance player, String command) + { + + if (command.startsWith("registro")) + { +LastMan.register(player); + } + else if (command.startsWith("remove")) + { + LastMan.unregister(player); + } + else if (command.startsWith("retirarclan")) + { + ClanWar.unregisterClanWar(player); + } + else if (command.startsWith("registrarclan")) + { + ClanWar.registerClanWar(player); + } + } + + +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/network/clientpackets/RequestRestart.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/clientpackets/RequestRestart.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/clientpackets/RequestRestart.java (working copy) @@ -91,6 +91,14 @@ player.sendPacket(ActionFailed.STATIC_PACKET); return; } + + if(player.inWARCLANZONE == true) + { + player.sendMessage("You cannot Logout while in registered in an Event."); + player.sendPacket(ActionFailed.STATIC_PACKET); + return; + } + // Check if player is in combat if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING)) { Index: head-src/com/l2jdesire/gameserver/network/serverpackets/Die.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/serverpackets/Die.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/serverpackets/Die.java (working copy) @@ -27,11 +27,13 @@ import com.l2jdesire.gameserver.model.L2SiegeClan; import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; import com.l2jdesire.gameserver.model.entity.event.CTF; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; import com.l2jdesire.gameserver.model.entity.event.DM; import com.l2jdesire.gameserver.model.entity.event.LastMan; import com.l2jdesire.gameserver.model.entity.event.TvT; import com.l2jdesire.gameserver.model.entity.siege.Castle; import com.l2jdesire.gameserver.model.entity.siege.Fort; +import com.l2jdesire.util.random.Rnd; /** * sample 0b 952a1048 objectId 00000000 00000000 00000000 00000000 00000000 00000000 format dddddd rev 377 format @@ -61,6 +63,7 @@ L2PcInstance player = (L2PcInstance) cha; _access = player.getAccessLevel(); _clan = player.getClan(); + if(player.inLASTMAN == true && com.l2jdesire.gameserver.model.entity.event.LastMan.ativo == true) { player.getAppearance().setTitleColor(player._originalColorTitle); @@ -76,7 +79,9 @@ _canTeleport = !((TvT.is_started() && player._inEventTvT) || (DM.is_started() && player._inEventDM) || (CTF.is_started() && player._inEventCTF) - || player.isInFunEvent() || player.isInArenaEvent() || player.inLASTMAN == true + || player.isInFunEvent() || player.isInArenaEvent() + || (ClanWar.is_startedwar() && player.isInClanWarEvent()) + || (LastMan.ativo == true && player.inLASTMAN == true) || player.isPendingRevive()); } _charObjId = cha.getObjectId(); Index: head-src/com/l2jdesire/gameserver/model/entity/Announcements.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/entity/Announcements.java (revision 3) +++ head-src/com/l2jdesire/gameserver/model/entity/Announcements.java (working copy) @@ -284,7 +284,22 @@ cs = null; } + + public void gameAnnouncetoClanWar(String text) + { + CreatureSay cs = new CreatureSay(0, 18, "", "ClanWar: "+text); + for(L2PcInstance player : L2World.getInstance().getAllPlayers()) + { + if(player != null) + if(player.isOnline()!=0) + player.sendPacket(cs); + } + + cs = null; + } + + public void announceToAll(SystemMessage sm) { for(L2PcInstance player : L2World.getInstance().getAllPlayers()) Index: head-src/com/l2jdesire/gameserver/InitialClanWar.java =================================================================== --- head-src/com/l2jdesire/gameserver/InitialClanWar.java (revision 0) +++ head-src/com/l2jdesire/gameserver/InitialClanWar.java (working copy) @@ -0,0 +1,110 @@ + package com.l2jdesire.gameserver; + + import java.text.SimpleDateFormat; + import java.util.Calendar; + import java.util.logging.Logger; + + import com.l2jdesire.Config; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.entity.event.LastMan; +import com.l2jdesire.gameserver.thread.ThreadPoolManager; + + /** + * This Config for Auto Restart GameServer + * Initialize class getInstance() + * Set Time in Config File + * Thank You L2JServer | L2JRussia + * + * @author L2JRussia + * + */ + public class InitialClanWar + { + //Variaveis globais + private static InitialClanWar _instance = null; + protected static final Logger _log = Logger.getLogger(InitialClanWar.class.getName()); + private Calendar NextRestart; + private SimpleDateFormat format = new SimpleDateFormat("HH:mm"); + + //Singleton + public static InitialClanWar getInstance() + { + if(_instance == null) + _instance = new InitialClanWar(); + return _instance; + } + + public String getRestartNextTime() + { + if(NextRestart.getTime() != null) + return format.format(NextRestart.getTime()); + else + return "Erro"; + } + + //Connstrutor + private InitialClanWar() + { + //:D + } + + public void StartCalculationOfNextClanWarTime() + { + _log.info("#####################################"); + _log.info("#[ClanWar System]: System actived...#"); + _log.info("#####################################"); + try + { + Calendar currentTime = Calendar.getInstance(); + Calendar testStartTime = null; + long flush2 = 0,timeL = 0; + int count = 0; + + for (String timeOfDay : Config.CLANWAR_INTERVAL_BY_TIME_OF_DAY) + { + testStartTime = Calendar.getInstance(); + testStartTime.setLenient(true); + String[] splitTimeOfDay = timeOfDay.split(":"); + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0])); + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1])); + testStartTime.set(Calendar.SECOND, 00); + //Verifica a validade to tempo + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis()) + { + testStartTime.add(Calendar.DAY_OF_MONTH, 1); + } + + //TimeL Recebe o quanto falta de milisegundos para o restart + timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis(); + + //Verifica qual horario sera o proximo restart + if(count == 0){ + flush2 = timeL; + NextRestart = testStartTime; + } + + if(timeL < flush2){ + flush2 = timeL; + NextRestart = testStartTime; + } + + count ++; + } + _log.info("[AutoEvent]: Next Restart Time: " + NextRestart.getTime().toString()); + ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2); + } + catch (Exception e) + { + System.out.println("[ClanWar]: The ClanWar automated server presented error in load restarts period config !"); + } + } + + class StartRestartTask implements Runnable + { + public void run() + { +ClanWar.eventowar(); +InitialClanWar.getInstance().StartCalculationOfNextClanWarTime(); +return; + } + } +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/handler/voicedcommandhandlers/ClanWarvoice.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/voicedcommandhandlers/ClanWarvoice.java (revision 0) +++ head-src/com/l2jdesire/gameserver/handler/voicedcommandhandlers/ClanWarvoice.java (working copy) @@ -0,0 +1,26 @@ +package com.l2jdesire.gameserver.handler.voicedcommandhandlers; + +import com.l2jdesire.gameserver.handler.IVoicedCommandHandler; +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; + +public class ClanWarvoice implements IVoicedCommandHandler +{ + private static final String[] _voicedCommands = { "joincw", "leavecw" }; + + @Override + public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target) + { + if (command.equals("joincw")) + ClanWar.registerClanWar(activeChar); + if (command.equals("leavecw")) + ClanWar.unregisterClanWar(activeChar); + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return _voicedCommands; + } +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/model/L2Character.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/L2Character.java (revision 3) +++ head-src/com/l2jdesire/gameserver/model/L2Character.java (working copy) @@ -172,6 +172,7 @@ /** The _is buff protected. */ private boolean _isBuffProtected = false; //Protect From Debuffs + private boolean _isInsideClanwarZone = false; /** The _is afraid. */ private boolean _isAfraid = false; // Flee in a random direction @@ -11323,6 +11324,23 @@ return _triggeredSkills; } + + /** + * @return the _isInsideClanwarZone + */ + public boolean isInsideClanwarZone() + { + return _isInsideClanwarZone; + } + + /** + * @param _isInsideClanwarZone the _isInsideClanwarZone to set + */ + public void setIsInsideClanwarZone(boolean _isInsideClanwarZone) + { + this._isInsideClanwarZone = _isInsideClanwarZone; + } + /** * Set target of L2Attackable and update it. * @author: Nefer
  6. alguem tem adaptado para Jfrozen? obrigao!
  7. Oi, alguém tem esse evento para o jfrozen? por favor! ### Eclipse Workspace Patch 1.0 #P L2jDesire_GameServer Index: head-src/com/l2jdesire/gameserver/datatables/xml/ZoneData.java =================================================================== --- head-src/com/l2jdesire/gameserver/datatables/xml/ZoneData.java (revision 3) +++ head-src/com/l2jdesire/gameserver/datatables/xml/ZoneData.java (working copy) @@ -50,6 +50,7 @@ import com.l2jdesire.gameserver.model.zone.type.L2CastleTeleportZone; import com.l2jdesire.gameserver.model.zone.type.L2CastleZone; import com.l2jdesire.gameserver.model.zone.type.L2ClanHallZone; +import com.l2jdesire.gameserver.model.zone.type.L2ClanWarZone; import com.l2jdesire.gameserver.model.zone.type.L2CustomZone; import com.l2jdesire.gameserver.model.zone.type.L2DamageZone; import com.l2jdesire.gameserver.model.zone.type.L2DerbyTrackZone; @@ -71,40 +72,39 @@ { temp = new L2CustomZone(zoneId); } - else if(zoneType.equals("SwampZone")) + else if (zoneType.equals("SwampZone")) { temp = new L2SwampZone(zoneId); } - + else if (zoneType.equals("FlagZone")) + { + temp = new L2ClanWarZone(zoneId); + } + // Check for unknown type - if(temp == null) + if (temp == null) { _log.warning("ZoneData: No such zone type: " + zoneType); continue; } - + zoneType = null; - - //get the zone shape from file if any + // get the zone shape from file if any + int[][] coords = null; int[] point; FastList<int[]> rs = FastList.newInstance(); Index: head-src/com/l2jdesire/gameserver/model/entity/event/ClanWar.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/entity/event/ClanWar.java (revision 0) +++ head-src/com/l2jdesire/gameserver/model/entity/event/ClanWar.java (working copy) @@ -0,0 +1,305 @@ +package com.l2jdesire.gameserver.model.entity.event; + +import javolution.util.FastList; + +import com.l2jdesire.Config; +import com.l2jdesire.gameserver.datatables.sql.NpcTable; +import com.l2jdesire.gameserver.datatables.sql.SpawnTable; +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.Announcements; +import com.l2jdesire.gameserver.model.spawn.L2Spawn; +import com.l2jdesire.gameserver.templates.L2NpcTemplate; +import com.l2jdesire.util.random.Rnd; + +/** + * This class ... + * @version $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ + */ +public class ClanWar implements Runnable +{ + public static FastList<L2PcInstance> _warplayers = new FastList<L2PcInstance>(); + public static L2Spawn _npcSpawn; + public static boolean ativowar = false; + public static boolean registrowar = false; + + @Override + public void run() + { + if (ativowar == true) + { + return; + } + eventowar(); + + } + + public static void eventowar() + { + NpcSpawnClanWarMan(); + ativowar = true; + registrowar = true; + Announcements.getInstance().gameAnnouncetoClanWar("ClanWar Started"); + Announcements.getInstance().gameAnnouncetoClanWar("5 minute(s) till registration close"); + Announcements.getInstance().gameAnnouncetoClanWar("Use to .joincw or .leavecw or go to giran"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("4 minute(s) till registration close"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("3 minute(s) till registration close"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("2 minute(s) till registration close"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("1 minute(s) till registration close"); + wait(1); + unspawnNpcClanWarMan(); + if (_warplayers.size() < 3) + { + for (L2PcInstance pp : _warplayers) + { + pp.inWARCLANZONE = false; + } + Announcements.getInstance().gameAnnouncetoClanWar("Minimum 3 participants for the event to happen"); + clearClanWar(); + return; + } + registrowar = false; + teleportClanWar(false); + setUserData(); + prepare(); + Announcements.getInstance().gameAnnouncetoClanWar("You have 45 seconds to get prepared"); + waitSecs(45); + start(); + Announcements.getInstance().gameAnnouncetoClanWar("8 minute(s) till event ClanWar finish!"); + wait(3); + Announcements.getInstance().gameAnnouncetoClanWar("5 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("4 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("3 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("2 minute(s) till event ClanWar finish!"); + wait(1); + Announcements.getInstance().gameAnnouncetoClanWar("1 minute(s) till event ClanWar finish!"); + wait(1); + ativowar = false; + Announcements.getInstance().gameAnnouncetoClanWar("The event ClanWar ended congratulations!"); + waitSecs(1); + teleportClanWar(true); + clearClanWar(); + } + + public static boolean is_startedwar() + { + return ativowar; + } + + public static void teleportClanWar(boolean back) + { + if (!back) + { + for (L2PcInstance p : _warplayers) + { + p.restoreCP(); + p.restoreHPMP(); + p.teleToLocation(45527 + Rnd.get(3001) - 700, 49562 + Rnd.get(1501) - 500, -3071); + p.sendMessage("You have been moved to coliseum"); + } + } + else + { + for (L2PcInstance p : _warplayers) + { + p.getAppearance().setNameColor(p._originalcolorclanwar); + p.setTitle(p._originaltitleclanwar); + p.inWARCLANZONE = false; + _warplayers.remove(p); + p.teleToLocation(82813, 148344, -3471); + p.sendMessage("You have been moved to giran"); + } + } + } + + public static void registerClanWar(L2PcInstance p) + { + + if (_warplayers.contains(p)) + { + p.sendMessage("You have already register"); + return; + } + if (p.getClan() == null) + { + p.sendMessage("You don't have clan"); + return; + } + if (registrowar == false) + { + p.sendMessage("Can't register now"); + return; + } + if (p.isInOlympiadMode()) + { + p.sendMessage("You can't register while you have register for olympiad match"); + return; + } + if (p.isInFunEvent()) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (p.isInArenaEvent()) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (p.inLASTMAN == true) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (EvtArenaManager.getInstance().isRegistered(p)) + { + p.sendMessage("You can't register while you have register for other Event"); + return; + } + if (p.getKarma() > 0) + { + p.sendMessage("You can not register pk"); + return; + } + _warplayers.add(p); + p.sendMessage("You successfully registered for the event"); + p.inWARCLANZONE = true; + } + + public static void unregisterClanWar(L2PcInstance p) + { + if (!_warplayers.contains(p)) + { + p.sendMessage("You have already unregister"); + return; + } + + if (registrowar == false) + { + p.sendMessage("You can't unregister while match is about to begin"); + return; + } + + _warplayers.remove(p); + p.sendMessage("Succesfully unregistered"); + p.inWARCLANZONE = false; + } + + public static void prepare() + { + for (L2PcInstance p : _warplayers) + { + p.setIsInvul(true); + p.setIsRooted(true); + p.sendMessage("You have 45 seconds to get prepared"); + } + } + + public static void start() + { + + for (L2PcInstance p : _warplayers) + { + p.stopRooting(null); + p.setIsInvul(false); + p.sendMessage("Go go go,start fighting"); + } + } + + private static void NpcSpawnClanWarMan() + { + L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(Config.LASTMAN_ID_NPC);// ID do mob + try + { + _npcSpawn = new L2Spawn(tmpl); + + _npcSpawn.setLocx(82640); // loc x + _npcSpawn.setLocy(148519); // loc y + _npcSpawn.setLocz(-3472); // loc z + _npcSpawn.setAmount(1); + _npcSpawn.setHeading(0); + _npcSpawn.setRespawnDelay(1); + + SpawnTable.getInstance().addNewSpawn(_npcSpawn, false); + + _npcSpawn.init(); + _npcSpawn.getLastSpawn().setTitle("ClanWar"); + _npcSpawn.getLastSpawn().isAggressive(); + _npcSpawn.getLastSpawn().decayMe(); + _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ()); + } + catch (Exception e) + { + System.out.println("Erro no evento"); + } + } + + private static void unspawnNpcClanWarMan() + { + if (_npcSpawn == null || _npcSpawn.getLastSpawn() == null) + return; + + _npcSpawn.getLastSpawn().deleteMe(); + _npcSpawn.stopRespawn(); + SpawnTable.getInstance().deleteSpawn(_npcSpawn, true); + } + + public static void clearClanWar() + { + for (L2PcInstance p : _warplayers) + { + p.inWARCLANZONE = false; + } + _warplayers.clear(); + ativowar = false; + registrowar = false; + } + + public static void waitSecs(int i) + { + try + { + Thread.sleep(i * 1000); + } + catch (InterruptedException ie) + { + ie.printStackTrace(); + } + } + + public static void wait(int i) + { + try + { + Thread.sleep(i * 60000); + } + catch (InterruptedException ie) + { + ie.printStackTrace(); + } + } + + public static void setUserData() + { + final FastList<L2PcInstance> players = getPlayers(); + + for (final L2PcInstance player : players) + { + player._originalcolorclanwar = player.getAppearance().getNameColor(); + player._originaltitleclanwar = player.getTitle(); + player.getAppearance().setNameColor(Config.CLANWARANEMCOLOR); + player.setTitle("ClanWar Event"); + player.setKarma(0); + player.broadcastUserInfo(); + } + } + + protected synchronized static FastList<L2PcInstance> getPlayers() + { + return _warplayers; + } + +} Index: head-src/com/l2jdesire/gameserver/handler/AdminCommandHandler.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/AdminCommandHandler.java (revision 3) +++ head-src/com/l2jdesire/gameserver/handler/AdminCommandHandler.java (working copy) @@ -34,6 +34,7 @@ import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminBuffs; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminCTFEngine; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminClanFull; +import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminClanWar; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminLastMan; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminVip; import com.l2jdesire.gameserver.handler.admincommandhandlers.AdminCache; @@ -129,6 +130,7 @@ registerAdminCommandHandler(new AdminKill()); registerAdminCommandHandler(new AdminTarget()); registerAdminCommandHandler(new AdminShop()); + registerAdminCommandHandler(new AdminClanWar()); registerAdminCommandHandler(new AdminVip()); registerAdminCommandHandler(new AdminCTFEngine()); registerAdminCommandHandler(new AdminVIPEngine()); Index: head-src/com/l2jdesire/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/actor/instance/L2PcInstance.java (revision 3) +++ head-src/com/l2jdesire/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -141,6 +141,7 @@ import com.l2jdesire.gameserver.model.entity.Duel; import com.l2jdesire.gameserver.model.entity.L2Rebirth; import com.l2jdesire.gameserver.model.entity.event.CTF; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; import com.l2jdesire.gameserver.model.entity.event.DM; import com.l2jdesire.gameserver.model.entity.event.EvtArenaManager; import com.l2jdesire.gameserver.model.entity.event.L2Event; @@ -719,7 +720,7 @@ /** The _client. */ private L2GameClient _client; - + /** The _account name. */ private String _accountName; @@ -2019,7 +2020,7 @@ public void logout(boolean kicked) { // prevent from player disconnect when in Event - if(isInLastMan()) + if (isInLastMan()) { } if (atEvent) @@ -5661,12 +5662,12 @@ { if (_client != null) { - if(isInLastMan()) + if (isInLastMan()) { } _client.close(new LeaveWorld()); setClient(null); - + } } @@ -7303,6 +7304,22 @@ }, Config.TVT_REVIVE_DELAY); } } + else if (inWARCLANZONE) + { + if (ClanWar.ativowar || inWARCLANZONE == true) + { + sendMessage("You will be revived and teleported in 10 seconds!"); + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() + { + @Override + public void run() + { + teleToLocation(45527 + Rnd.get(3001) - 700, 49562 + Rnd.get(1501) - 500, -3071); + doRevive(); + } + }, 10000); + } + } else if (_inEventCTF) { if (CTF.is_teleport() || CTF.is_started()) @@ -7705,6 +7722,14 @@ return; } + if (isInsideClanwarZone() && targetPlayer.isInsideClanwarZone() && (getClan() != null) && (targetPlayer.getClan() != null) && (getClanId() != targetPlayer.getClanId())) + { + getInventory().addItem("Event", Config.CLANWAR_ITEM_ID, Config.CLANWAR_ITEM_QUANTIA, null, null); + sendMessage("You killed someone from an enemy clan."); + getClan().setRep***tionScore(getClan().getRep***tionScore() + Config.REPUTATION_QUANTITY_CLANWAR, true); + setKarma(0); + } + // Check if it's pvp if (checkIfPvP(target) && targetPlayer.getPvpFlag() != 0 || isInsideZone(ZONE_PVP) && targetPlayer.isInsideZone(ZONE_PVP)) { @@ -8210,7 +8235,7 @@ */ public void increasePkKillsAndKarma(int targLVL) { - if ((TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP)) + if ((TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP) || ClanWar.ativowar == true) return; int baseKarma = Config.KARMA_MIN_KARMA; @@ -19323,17 +19348,22 @@ { return inArenaEvent; } - + public boolean isInClanWarEvent() + { + return inWARCLANZONE; + } private int arenaDefeats; private int arenaWins; - //Arena + // Arena public boolean inLASTMAN = false; public boolean ForaLastMan = true; public int _originalColorTitle; + public int _originalcolorclanwar; + public String _originaltitleclanwar; public String _originaltitlelast; public static boolean revive = false; - + public boolean inWARCLANZONE = false; public boolean isInLastMan() Index: head-src/com/l2jdesire/gameserver/model/zone/type/L2ClanWarZone.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/zone/type/L2ClanWarZone.java (revision 0) +++ head-src/com/l2jdesire/gameserver/model/zone/type/L2ClanWarZone.java (working copy) @@ -0,0 +1,74 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.l2jdesire.gameserver.model.zone.type; + +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.zone.L2ZoneType; +import com.l2jdesire.gameserver.model.L2Character; +import com.l2jdesire.gameserver.thread.ThreadPoolManager; +import com.l2jdesire.util.random.Rnd; + +public class L2ClanWarZone extends L2ZoneType +{ + + /** + * @param id + */ + public L2ClanWarZone(int id) + { + super(id); + } + + @Override + protected void onEnter(L2Character character) + { + if (ClanWar.ativowar == true) + { + if (character instanceof L2PcInstance) + { + if (((L2PcInstance) character).getClan() != null && ((L2PcInstance) character).inWARCLANZONE == true) + { + ((L2PcInstance) character).setIsInsideClanwarZone(true); + ((L2PcInstance) character).sendMessage("You have entered a Clan War Zone. Prepare for fight."); + } + else + { + ((L2PcInstance) character).sendMessage("This is strict area for clan members ONLY. or not at the time of the event"); + ((L2PcInstance) character).teleToLocation(83302, 148125, -3408); + } + } + } + } + + @Override + protected void onExit(L2Character character) + { + if(((L2PcInstance) character).isInClanWarEvent()) + { + if(!((L2PcInstance) character).isDead()) + { + ThreadPoolManager.getInstance().scheduleGeneral(new BackToZone(character), 2000); + } + ((L2PcInstance) character).sendMessage("You can't cheat your way out of here. You must wait ClanWar time is over."); + } + if (character instanceof L2PcInstance) + { + ((L2PcInstance) character).setIsInsideClanwarZone(false); + } + } + + @Override + public void onDieInside(L2Character character) + { + + } + + @Override + public void onReviveInside(L2Character character) + { + onEnter(character); + } + + static class BackToZone implements Runnable + { + private L2PcInstance _activeChar; + + BackToZone(L2Character character) + { + _activeChar = (L2PcInstance) character; + } + + @Override + public void run() + { + _activeChar.teleToLocation(45819, 49359, -3066); // Elven Village + } +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/handler/admincommandhandlers/AdminClanWar.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/admincommandhandlers/AdminClanWar.java (revision 0) +++ head-src/com/l2jdesire/gameserver/handler/admincommandhandlers/AdminClanWar.java (working copy) @@ -0,0 +1,48 @@ +// Decompiled by DJ v3.11.11.95 Copyright 2009 Atanas Neshkov Date: 26/7/2011 21:21:40 +// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! +// Decompiler options: packimports(3) +// Source File Name: AdminClanFull.java + +package com.l2jdesire.gameserver.handler.admincommandhandlers; + +import com.l2jdesire.gameserver.handler.IAdminCommandHandler; +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.entity.event.LastMan; +import com.l2jdesire.gameserver.thread.ThreadPoolManager; + +public class AdminClanWar implements IAdminCommandHandler +{ + + public AdminClanWar() + { + } + + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + if (command.startsWith("admin_clanwar")) + { + try + { + ThreadPoolManager.getInstance().scheduleGeneral(new ClanWar(), 1); + + } + catch (Exception e) + { + activeChar.sendMessage("Usage: //clanwar"); + } + } + return true; + } + + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } + + private static final String ADMIN_COMMANDS[] = + { + "admin_clanwar" + }; + +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/network/L2GameClient.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/L2GameClient.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/L2GameClient.java (working copy) @@ -838,6 +838,15 @@ L2PcInstance player = L2GameClient.this.getActiveChar(); if (player != null) // this should only happen on connection loss { + if(player.inWARCLANZONE == true) + { + player.getAppearance().setNameColor(player._originalcolorclanwar); + player.setTitle(player._originaltitleclanwar); + com.l2jdesire.gameserver.model.entity.event.ClanWar._warplayers.remove(player); + player.inWARCLANZONE = false; + player.teleToLocation(82813, 148344, -3471); + player.setKarma(0); + } if(player.inLASTMAN == true) { player.getAppearance().setTitleColor(player._originalColorTitle); Index: head-src/com/l2jdesire/gameserver/GameServer.java =================================================================== --- head-src/com/l2jdesire/gameserver/GameServer.java (revision 3) +++ head-src/com/l2jdesire/gameserver/GameServer.java (working copy) @@ -574,14 +574,19 @@ else _log.info("# Auto LastMan System is Disabled #"); - System.gc(); if(Config.EVENT_BY_TIME_OF_DAY) InitialBossManager.getInstance().StartCalculationOfNextBossTime(); else _log.info("# Auto BossManager System is Disabled #"); - System.gc(); + + if(Config.CLANWAR_BY_TIME_OF_DAY) + InitialClanWar.getInstance().StartCalculationOfNextClanWarTime(); + else + _log.info("# Auto ClanWar System is Disabled #"); + + System.gc(); Util.printSection("Info"); _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch()); Index: head-src/com/l2jdesire/Config.java =================================================================== --- head-src/com/l2jdesire/Config.java (revision 3) +++ head-src/com/l2jdesire/Config.java (working copy) @@ -666,12 +666,20 @@ public static int FS_TIME_ATTACK; public static int FS_TIME_COOLDOWN; + public static int CLANWAR_ITEM_QUANTIA; + public static int CLANWAR_ITEM_ID; + public static int CLANWARANEMCOLOR; + public static int REPUTATION_QUANTITY_CLANWAR; public static int FS_TIME_ENTRY; public static int FS_TIME_WARMUP; public static int FS_PARTY_MEMBER_COUNT; public static boolean LASTMAN_BY_TIME_OF_DAY; public static String[] LASTMAN_INTERVAL_BY_TIME_OF_DAY; + + public static boolean CLANWAR_BY_TIME_OF_DAY; + public static String[] CLANWAR_INTERVAL_BY_TIME_OF_DAY; + public static boolean ALLOW_QUAKE_SYSTEM; public static boolean ENABLE_ANTI_PVP_FARM_MSG; @@ -790,6 +798,14 @@ ALLOW_GUARDS = Boolean.valueOf(otherSettings.getProperty("AllowGuards", "False")); EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("CancelLesserEffect", "True")); LASTMANCOLOR = Integer.decode("0x" + otherSettings.getProperty("LASTMANCOLOR", "00FF00")); + + CLANWARANEMCOLOR = Integer.decode("0x" + otherSettings.getProperty("NameColorClanWar", "00FF00")); + CLANWAR_ITEM_ID = Integer.parseInt(otherSettings.getProperty("ClanWarItemID", "57")); + CLANWAR_ITEM_QUANTIA = Integer.parseInt(otherSettings.getProperty("ClanWarItemQuantia", "80")); + REPUTATION_QUANTITY_CLANWAR = Integer.parseInt(otherSettings.getProperty("Rep***tionQuantia", "180")); + CLANWAR_BY_TIME_OF_DAY = Boolean.parseBoolean(otherSettings.getProperty("EnableClanWarSystem", "false")); + CLANWAR_INTERVAL_BY_TIME_OF_DAY = otherSettings.getProperty("ClanWarByTimeOfDay", "20:00").split(","); + WYVERN_SPEED = Integer.parseInt(otherSettings.getProperty("WyvernSpeed", "100")); LASTMAN_BY_TIME_OF_DAY = Boolean.parseBoolean(otherSettings.getProperty("EnableLastManSystem", "false")); LASTMAN_INTERVAL_BY_TIME_OF_DAY = otherSettings.getProperty("LastManByTimeOfDay", "20:00").split(","); Index: head-src/com/l2jdesire/gameserver/network/clientpackets/Logout.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/clientpackets/Logout.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/clientpackets/Logout.java (working copy) @@ -29,6 +29,7 @@ import com.l2jdesire.gameserver.network.L2GameClient; import com.l2jdesire.gameserver.network.SystemMessageId; import com.l2jdesire.gameserver.network.serverpackets.ActionFailed; +import com.l2jdesire.gameserver.network.serverpackets.RestartResponse; import com.l2jdesire.gameserver.network.serverpackets.SystemMessage; import com.l2jdesire.gameserver.taskmanager.AttackStanceTaskManager; @@ -56,6 +57,13 @@ return; } + if(player.inWARCLANZONE == true) + { + player.sendMessage("You cannot Logout while in registered in an Event."); + player.sendPacket(ActionFailed.STATIC_PACKET); + return; + } + if(player.inLASTMAN == true) { player.sendMessage("You cannot Logout while in registered in an Event."); @@ -63,6 +71,7 @@ return; } + if (player.isInFunEvent() && !player.isGM()) { player.sendMessage("You cannot Logout while in registered in an Event."); @@ -97,6 +106,16 @@ return; } + if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING)) + { + if(Config.DEBUG) + _log.fine("Player " + player.getName() + " tried to logout while fighting."); + + player.sendPacket(new SystemMessage(SystemMessageId.CANT_RESTART_WHILE_FIGHTING)); + sendPacket(RestartResponse.valueOf(false)); + return; + } + if (player.isInLastMan()) { player.sendMessage("You cannot Logout while is in Combat mode."); Index: head-src/com/l2jdesire/gameserver/handler/VoicedCommandHandler.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/VoicedCommandHandler.java (revision 3) +++ head-src/com/l2jdesire/gameserver/handler/VoicedCommandHandler.java (working copy) @@ -28,6 +28,7 @@ import com.l2jdesire.gameserver.handler.voicedcommandhandlers.AwayCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.BankingCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.CTFCmd; +import com.l2jdesire.gameserver.handler.voicedcommandhandlers.ClanWarvoice; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.DMCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.FarmPvpCmd; import com.l2jdesire.gameserver.handler.voicedcommandhandlers.OfflineShop; @@ -67,6 +68,7 @@ registerVoicedCommandHandler(new Voting()); registerVoicedCommandHandler(new eventlhe()); + registerVoicedCommandHandler(new ClanWarvoice()); if (Config.BANKING_SYSTEM_ENABLED) { Index: head-src/com/l2jdesire/gameserver/model/actor/instance/L2EngineEventInstance.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/actor/instance/L2EngineEventInstance.java (revision 0) +++ head-src/com/l2jdesire/gameserver/model/actor/instance/L2EngineEventInstance.java (working copy) @@ -0,0 +1,138 @@ +/* This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * http://www.gnu.org/copyleft/gpl.html + */ +package com.l2jdesire.gameserver.model.actor.instance; + +import com.l2jdesire.Config; +import com.l2jdesire.gameserver.ai.CtrlIntention; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.entity.event.LastMan; +import com.l2jdesire.gameserver.network.serverpackets.ActionFailed; +import com.l2jdesire.gameserver.network.serverpackets.MyTargetSelected; +import com.l2jdesire.gameserver.network.serverpackets.NpcHtmlMessage; +import com.l2jdesire.gameserver.network.serverpackets.ValidateLocation; +import com.l2jdesire.gameserver.templates.L2NpcTemplate; + +/** + * @author Axcel Kuhn + */ +public class L2EngineEventInstance extends L2FolkInstance + { + public L2EngineEventInstance(int objectId, L2NpcTemplate template) + { + super(objectId, template); + } + + @Override + public void onAction(L2PcInstance player) + { + if (!canTarget(player)) + return; + + player.setLastFolkNPC(this); + + // Check if the L2PcInstance already target the L2NpcInstance + if (this != player.getTarget()) + { + // Set the target of the L2PcInstance player + player.setTarget(this); + + // Send a Server->Client packet MyTargetSelected to the L2PcInstance player + MyTargetSelected my = new MyTargetSelected(getObjectId(), 0); + player.sendPacket(my); + my = null; + + // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client + player.sendPacket(new ValidateLocation(this)); + } + else + { + // Calculate the distance between the L2PcInstance and the L2NpcInstance + if (!canInteract(player)) + { + // Notify the L2PcInstance AI with AI_INTENTION_INTERACT + player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); + } + else + { + if(ClanWar.ativowar == true) + { + showMessageWindowClanWar(player); + } + if(LastMan.ativo == true) + { + showMessageWindow(player); + } + } + } + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet + player.sendPacket(ActionFailed.STATIC_PACKET); + } + + private void showMessageWindow(L2PcInstance player) + { + String filename = "data/html/mods/LastMan/start.htm"; + + NpcHtmlMessage html = new NpcHtmlMessage(1); + html.setFile(filename); + html.replace("%objectId%", String.valueOf(getObjectId())); + html.replace("%servername%", Config.ALT_Server_Name); + player.sendPacket(html); + filename = null; + html = null; + } + + private void showMessageWindowClanWar(L2PcInstance player) + { + String filename = "data/html/mods/ClanWar/start.htm"; + + NpcHtmlMessage html = new NpcHtmlMessage(1); + html.setFile(filename); + html.replace("%objectId%", String.valueOf(getObjectId())); + html.replace("%servername%", Config.ALT_Server_Name); + player.sendPacket(html); + filename = null; + html = null; + } + + + + + @Override + public void onBypassFeedback(L2PcInstance player, String command) + { + + if (command.startsWith("registro")) + { +LastMan.register(player); + } + else if (command.startsWith("remove")) + { + LastMan.unregister(player); + } + else if (command.startsWith("retirarclan")) + { + ClanWar.unregisterClanWar(player); + } + else if (command.startsWith("registrarclan")) + { + ClanWar.registerClanWar(player); + } + } + + +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/network/clientpackets/RequestRestart.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/clientpackets/RequestRestart.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/clientpackets/RequestRestart.java (working copy) @@ -91,6 +91,14 @@ player.sendPacket(ActionFailed.STATIC_PACKET); return; } + + if(player.inWARCLANZONE == true) + { + player.sendMessage("You cannot Logout while in registered in an Event."); + player.sendPacket(ActionFailed.STATIC_PACKET); + return; + } + // Check if player is in combat if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING)) { Index: head-src/com/l2jdesire/gameserver/network/serverpackets/Die.java =================================================================== --- head-src/com/l2jdesire/gameserver/network/serverpackets/Die.java (revision 3) +++ head-src/com/l2jdesire/gameserver/network/serverpackets/Die.java (working copy) @@ -27,11 +27,13 @@ import com.l2jdesire.gameserver.model.L2SiegeClan; import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; import com.l2jdesire.gameserver.model.entity.event.CTF; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; import com.l2jdesire.gameserver.model.entity.event.DM; import com.l2jdesire.gameserver.model.entity.event.LastMan; import com.l2jdesire.gameserver.model.entity.event.TvT; import com.l2jdesire.gameserver.model.entity.siege.Castle; import com.l2jdesire.gameserver.model.entity.siege.Fort; +import com.l2jdesire.util.random.Rnd; /** * sample 0b 952a1048 objectId 00000000 00000000 00000000 00000000 00000000 00000000 format dddddd rev 377 format @@ -61,6 +63,7 @@ L2PcInstance player = (L2PcInstance) cha; _access = player.getAccessLevel(); _clan = player.getClan(); + if(player.inLASTMAN == true && com.l2jdesire.gameserver.model.entity.event.LastMan.ativo == true) { player.getAppearance().setTitleColor(player._originalColorTitle); @@ -76,7 +79,9 @@ _canTeleport = !((TvT.is_started() && player._inEventTvT) || (DM.is_started() && player._inEventDM) || (CTF.is_started() && player._inEventCTF) - || player.isInFunEvent() || player.isInArenaEvent() || player.inLASTMAN == true + || player.isInFunEvent() || player.isInArenaEvent() + || (ClanWar.is_startedwar() && player.isInClanWarEvent()) + || (LastMan.ativo == true && player.inLASTMAN == true) || player.isPendingRevive()); } _charObjId = cha.getObjectId(); Index: head-src/com/l2jdesire/gameserver/model/entity/Announcements.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/entity/Announcements.java (revision 3) +++ head-src/com/l2jdesire/gameserver/model/entity/Announcements.java (working copy) @@ -284,7 +284,22 @@ cs = null; } + + public void gameAnnouncetoClanWar(String text) + { + CreatureSay cs = new CreatureSay(0, 18, "", "ClanWar: "+text); + for(L2PcInstance player : L2World.getInstance().getAllPlayers()) + { + if(player != null) + if(player.isOnline()!=0) + player.sendPacket(cs); + } + + cs = null; + } + + public void announceToAll(SystemMessage sm) { for(L2PcInstance player : L2World.getInstance().getAllPlayers()) Index: head-src/com/l2jdesire/gameserver/InitialClanWar.java =================================================================== --- head-src/com/l2jdesire/gameserver/InitialClanWar.java (revision 0) +++ head-src/com/l2jdesire/gameserver/InitialClanWar.java (working copy) @@ -0,0 +1,110 @@ + package com.l2jdesire.gameserver; + + import java.text.SimpleDateFormat; + import java.util.Calendar; + import java.util.logging.Logger; + + import com.l2jdesire.Config; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; +import com.l2jdesire.gameserver.model.entity.event.LastMan; +import com.l2jdesire.gameserver.thread.ThreadPoolManager; + + /** + * This Config for Auto Restart GameServer + * Initialize class getInstance() + * Set Time in Config File + * Thank You L2JServer | L2JRussia + * + * @author L2JRussia + * + */ + public class InitialClanWar + { + //Variaveis globais + private static InitialClanWar _instance = null; + protected static final Logger _log = Logger.getLogger(InitialClanWar.class.getName()); + private Calendar NextRestart; + private SimpleDateFormat format = new SimpleDateFormat("HH:mm"); + + //Singleton + public static InitialClanWar getInstance() + { + if(_instance == null) + _instance = new InitialClanWar(); + return _instance; + } + + public String getRestartNextTime() + { + if(NextRestart.getTime() != null) + return format.format(NextRestart.getTime()); + else + return "Erro"; + } + + //Connstrutor + private InitialClanWar() + { + //:D + } + + public void StartCalculationOfNextClanWarTime() + { + _log.info("#####################################"); + _log.info("#[ClanWar System]: System actived...#"); + _log.info("#####################################"); + try + { + Calendar currentTime = Calendar.getInstance(); + Calendar testStartTime = null; + long flush2 = 0,timeL = 0; + int count = 0; + + for (String timeOfDay : Config.CLANWAR_INTERVAL_BY_TIME_OF_DAY) + { + testStartTime = Calendar.getInstance(); + testStartTime.setLenient(true); + String[] splitTimeOfDay = timeOfDay.split(":"); + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0])); + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1])); + testStartTime.set(Calendar.SECOND, 00); + //Verifica a validade to tempo + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis()) + { + testStartTime.add(Calendar.DAY_OF_MONTH, 1); + } + + //TimeL Recebe o quanto falta de milisegundos para o restart + timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis(); + + //Verifica qual horario sera o proximo restart + if(count == 0){ + flush2 = timeL; + NextRestart = testStartTime; + } + + if(timeL < flush2){ + flush2 = timeL; + NextRestart = testStartTime; + } + + count ++; + } + _log.info("[AutoEvent]: Next Restart Time: " + NextRestart.getTime().toString()); + ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2); + } + catch (Exception e) + { + System.out.println("[ClanWar]: The ClanWar automated server presented error in load restarts period config !"); + } + } + + class StartRestartTask implements Runnable + { + public void run() + { +ClanWar.eventowar(); +InitialClanWar.getInstance().StartCalculationOfNextClanWarTime(); +return; + } + } +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/handler/voicedcommandhandlers/ClanWarvoice.java =================================================================== --- head-src/com/l2jdesire/gameserver/handler/voicedcommandhandlers/ClanWarvoice.java (revision 0) +++ head-src/com/l2jdesire/gameserver/handler/voicedcommandhandlers/ClanWarvoice.java (working copy) @@ -0,0 +1,26 @@ +package com.l2jdesire.gameserver.handler.voicedcommandhandlers; + +import com.l2jdesire.gameserver.handler.IVoicedCommandHandler; +import com.l2jdesire.gameserver.model.actor.instance.L2PcInstance; +import com.l2jdesire.gameserver.model.entity.event.ClanWar; + +public class ClanWarvoice implements IVoicedCommandHandler +{ + private static final String[] _voicedCommands = { "joincw", "leavecw" }; + + @Override + public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target) + { + if (command.equals("joincw")) + ClanWar.registerClanWar(activeChar); + if (command.equals("leavecw")) + ClanWar.unregisterClanWar(activeChar); + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return _voicedCommands; + } +} No newline at end of file Index: head-src/com/l2jdesire/gameserver/model/L2Character.java =================================================================== --- head-src/com/l2jdesire/gameserver/model/L2Character.java (revision 3) +++ head-src/com/l2jdesire/gameserver/model/L2Character.java (working copy) @@ -172,6 +172,7 @@ /** The _is buff protected. */ private boolean _isBuffProtected = false; //Protect From Debuffs + private boolean _isInsideClanwarZone = false; /** The _is afraid. */ private boolean _isAfraid = false; // Flee in a random direction @@ -11323,6 +11324,23 @@ return _triggeredSkills; } + + /** + * @return the _isInsideClanwarZone + */ + public boolean isInsideClanwarZone() + { + return _isInsideClanwarZone; + } + + /** + * @param _isInsideClanwarZone the _isInsideClanwarZone to set + */ + public void setIsInsideClanwarZone(boolean _isInsideClanwarZone) + { + this._isInsideClanwarZone = _isInsideClanwarZone; + } + /** * Set target of L2Attackable and update it. * @author: Nefer Link do event: https://www.l2jbrasil.com/index.php?/topic/97146-clan-war/
  8. Olá, eu queria saber se alguém poderia ativar ou me ajudar a criar um html semelhante ou bonito como o da foto. Obrigado!
  9. Hola, alguien me podria ayudar con este error? esta en el archivo LastMan.java Olá, alguém poderia me ajudar com esse erro? está no arquivo LastMan.java AND IMAGEN ----> https://goo.gl/RCjK1x web no deja subir imagen :(
  10. [ENG] Hi guys! i need some help with my banner for npc. I want the logo to remain but with the transparent background. When I convert the image to .tga and pass it to Unreal, it adds me the white background. Already try turning it into .png and then .tga but still not working. Could someone help me? please [ESP] Hola gente! alguien me puede ayudar con el banner para mi npc. quiero que quede el logo pero con el fondo transparente. Cuando convierto la imagen a .tga y la paso al Unreal, este me agrega el fondo blanco. Ya intente convirtiendola en .png y luego .tga pero sigue sin funcionar. Alguien me podria ayudar? por favor [PTS] Oi gente! Alguém pode me ajudar com o banner para o meu npc. Quero que o logotipo permaneça, mas com o fundo transparente. Quando eu converter a imagem para .tga e passá-la para o Unreal, ela me adiciona o fundo branco. Já tente transformá-lo em .png e depois .tga, mas ainda não está funcionando. Alguém poderia me ajudar? por favor
  11. heladito92

    Web L2 PG 1.0

    help please! how i create the sql? anybody can help me with that?
×
×
  • Create New...