Перейти к содержанию
Авторизация  
Серый_Ветер

Воскрешение В Осадной Зоне

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

собственно хоцца добавить запрет за восрешение обычных чаров, которые не входят в осадную группу по захвату мирка, пардон, замка...

по сути одно условие:

если не входишь в осадную групу/клан - пошел лесом

 

собсвенно пока что только хочется...

 

где примерно копать нужно, чтобы выдрать нужный код...

 

дальше уже по мере возможностей...

 

нашел CastelDamageZoneDAO.java

Скрытый текст
package l2p.gameserver.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.List<Ljava.lang.String;>;
import l2p.commons.dbutils.DbUtils;
import l2p.gameserver.database.DatabaseFactory;
import l2p.gameserver.model.entity.residence.Residence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CastleDamageZoneDAO
{
 private static final CastleDamageZoneDAO _instance = new CastleDamageZoneDAO();
 private static final Logger _log = LoggerFactory.getLogger(CastleDoorUpgradeDAO.class);
 public static final String SELECT_SQL_QUERY = "SELECT zone FROM castle_damage_zones WHERE residence_id=?";
 public static final String INSERT_SQL_QUERY = "INSERT INTO castle_damage_zones (residence_id, zone) VALUES (?,?)";
 public static final String DELETE_SQL_QUERY = "DELETE FROM castle_damage_zones WHERE residence_id=?";

 public static CastleDamageZoneDAO getInstance()
 {
return _instance;
 }

 public List<String> load(Residence paramResidence)
 {
Object localObject1 = Collections.emptyList();
Connection localConnection = null;
PreparedStatement localPreparedStatement = null;
ResultSet localResultSet = null;
try
{
  localConnection = DatabaseFactory.getInstance().getConnection();
  localPreparedStatement = localConnection.prepareStatement("SELECT zone FROM castle_damage_zones WHERE residence_id=?");
  localPreparedStatement.setInt(1, paramResidence.getId());
  localResultSet = localPreparedStatement.executeQuery();
  localObject1 = new ArrayList();
  while (true)
  {
	if (!(localResultSet.next()))
	  break label87;
	label87: ((List)localObject1).add(localResultSet.getString("zone"));
  }
}
catch (Exception localException)
{
  _log.error("CastleDamageZoneDAO:load(Residence): " + localException, localException);
}
finally
{
  DbUtils.closeQuietly(localConnection, localPreparedStatement, localResultSet);
}
return ((List<String>)localObject1);
 }

 public void insert(Residence paramResidence, String paramString)
 {
Connection localConnection = null;
PreparedStatement localPreparedStatement = null;
try
{
  localConnection = DatabaseFactory.getInstance().getConnection();
  localPreparedStatement = localConnection.prepareStatement("INSERT INTO castle_damage_zones (residence_id, zone) VALUES (?,?)");
  localPreparedStatement.setInt(1, paramResidence.getId());
  localPreparedStatement.setString(2, paramString);
  localPreparedStatement.execute();
}
catch (Exception localException)
{
  _log.error("CastleDamageZoneDAO:insert(Residence, String): " + localException, localException);
}
finally
{
  DbUtils.closeQuietly(localConnection, localPreparedStatement);
}
 }

 public void delete(Residence paramResidence)
 {
Connection localConnection = null;
PreparedStatement localPreparedStatement = null;
try
{
  localConnection = DatabaseFactory.getInstance().getConnection();
  localPreparedStatement = localConnection.prepareStatement("DELETE FROM castle_damage_zones WHERE residence_id=?");
  localPreparedStatement.setInt(1, paramResidence.getId());
  localPreparedStatement.execute();
}
catch (Exception localException)
{
  _log.error("CastleDamageZoneDAO:delete(Residence): " + localException, localException);
}
finally
{
  DbUtils.closeQuietly(localConnection, localPreparedStatement);
}
 }
}

по описанию похоже на осадную зону возле крепости...

но оно не оно, точно не знаю...

 

нашел сам скил воскрешения:

Resurrect.class (ковыряюся в исходнике через jd)

Скрытый текст
package l2p.gameserver.skills.skillclasses;

import java.util.Iterator;
import java.util.List;
import java.util.Set;
import l2p.gameserver.cache.Msg;
import l2p.gameserver.listener.actor.player.impl.ReviveAnswerListener;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.Skill;
import l2p.gameserver.model.Skill.SkillTargetType;
import l2p.gameserver.model.base.BaseStats;
import l2p.gameserver.model.entity.events.GlobalEvent;
import l2p.gameserver.model.instances.PetInstance;
import l2p.gameserver.serverpackets.SystemMessage2;
import l2p.gameserver.serverpackets.components.CustomMessage;
import l2p.gameserver.serverpackets.components.SystemMsg;
import l2p.gameserver.templates.StatsSet;
import org.apache.commons.lang3.tuple.Pair;

public class Resurrect extends Skill
{
 private final boolean _canPet;

 public Resurrect(StatsSet paramStatsSet)
 {
super(paramStatsSet);
this._canPet = paramStatsSet.getBool("canPet", false);
 }

 public boolean checkCondition(Creature paramCreature1, Creature paramCreature2, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3)
 {
GlobalEvent localGlobalEvent;
if (!(paramCreature1.isPlayer()))
  return false;
if ((paramCreature2 == null) || ((paramCreature2 != paramCreature1) && (!(paramCreature2.isDead()))))
{
  paramCreature1.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
  return false;
}
Player localPlayer1 = (Player)paramCreature1;
Player localPlayer2 = paramCreature2.getPlayer();
if (localPlayer2 == null)
{
  localPlayer1.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
  return false;
}
if ((localPlayer1.isInOlympiadMode()) || (localPlayer2.isInOlympiadMode()))
{
  localPlayer1.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
  return false;
}
Object localObject = localPlayer1.getEvents().iterator();
while (((Iterator)localObject).hasNext())
{
  localGlobalEvent = (GlobalEvent)((Iterator)localObject).next();
  if (!(localGlobalEvent.canRessurect(localPlayer1, paramCreature2, paramBoolean1)))
  {
	localPlayer1.sendPacket(new SystemMessage2(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS).addSkillName(this));
	return false;
  }
}
if (oneTarget())
  if (paramCreature2.isPet())
  {
	localObject = localPlayer2.getAskListener(false);
	localGlobalEvent = ((localObject != null) && (((Pair)localObject).getValue() instanceof ReviveAnswerListener)) ? (ReviveAnswerListener)((Pair)localObject).getValue() : null;
	if (localGlobalEvent != null)
	{
	  if (localGlobalEvent.isForPet())
		paramCreature1.sendPacket(Msg.BETTER_RESURRECTION_HAS_BEEN_ALREADY_PROPOSED);
	  else
		paramCreature1.sendPacket(Msg.SINCE_THE_MASTER_WAS_IN_THE_PROCESS_OF_BEING_RESURRECTED_THE_ATTEMPT_TO_
RESURRECT_THE_PET_HAS_BEEN_CANCELLED);
	  return false;
	}
	if ((!(this._canPet)) && (this._targetType != Skill.SkillTargetType.TARGET_PET))
	{
	  localPlayer1.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
	  return false;
	}
  }
  else if (paramCreature2.isPlayer())
  {
	localObject = localPlayer2.getAskListener(false);
	localGlobalEvent = ((localObject != null) && (((Pair)localObject).getValue() instanceof ReviveAnswerListener)) ? (ReviveAnswerListener)((Pair)localObject).getValue() : null;
	if (localGlobalEvent != null)
	{
	  if (localGlobalEvent.isForPet())
		paramCreature1.sendPacket(Msg.WHILE_A_PET_IS_ATTEMPTING_TO_RESURRECT_IT_CANNOT_HELP_IN_RESURRECTING_IT
S_MASTER);
	  else
		paramCreature1.sendPacket(Msg.BETTER_RESURRECTION_HAS_BEEN_ALREADY_PROPOSED);
	  return false;
	}
	if (this._targetType == Skill.SkillTargetType.TARGET_PET)
	{
	  localPlayer1.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
	  return false;
	}
	if (localPlayer2.isFestivalParticipant())
	{
	  localPlayer1.sendMessage(new CustomMessage("l2p.gameserver.skills.skillclasses.Resurrect", localPlayer1, new Object[0]));
	  return false;
	}
  }
return super.checkCondition(paramCreature1, paramCreature2, paramBoolean1, paramBoolean2, paramBoolean3);
 }

 public void useSkill(Creature paramCreature, List<Creature> paramList)
 {
double d1 = this._power;
if ((d1 > 100.0D) && (!(isHandler())))
{
  double d2 = this._power * (BaseStats.WIT.calcBonus(paramCreature) - 1D);
  d1 = d1 + ((d2 < 20.0D) ? 20.0D : d2);
  if (d1 < 90.0D)
	d1 = 90.0D;
}
Iterator localIterator = paramList.iterator();
while (true)
{
  Creature localCreature;
  Object localObject1;
  while (true)
  {
	while (true)
	{
	  while (true)
	  {
		do
		{
		  while (true)
		  {
			if (!(localIterator.hasNext()))
			  break label341;
			localCreature = (Creature)localIterator.next();
			if (localCreature == null)
			  break label338;
			if (localCreature.getPlayer() != null)
			  break;
		  }
		  localObject1 = localCreature.getEvents().iterator();
		  while (((Iterator)localObject1).hasNext())
		  {
			localObject2 = (GlobalEvent)((Iterator)localObject1).next();
			if (!(((GlobalEvent)localObject2).canRessurect((Player)paramCreature, localCreature, true)))
			  break label338:
		  }
		  if ((localCreature.isPet()) && (this._canPet))
		  {
			if (localCreature.getPlayer() == paramCreature)
			{
			  ((PetInstance)localCreature).doRevive(d1);
			  break label318:
			}
			localCreature.getPlayer().reviveRequest((Player)paramCreature, d1, true);
			break label318:
		  }
		}
		while (!(localCreature.isPlayer()));
		if (this._targetType != Skill.SkillTargetType.TARGET_PET)
		  break;
	  }
	  localObject1 = (Player)localCreature;
	  Object localObject2 = ((Player)localObject1).getAskListener(false);
	  Object localObject3 = ((localObject2 != null) && (((Pair)localObject2).getValue() instanceof ReviveAnswerListener)) ? (ReviveAnswerListener)((Pair)localObject2).getValue() : null;
	  if (localObject3 == null)
		break;
	}
	if (!(((Player)localObject1).isFestivalParticipant()))
	  break;
  }
  ((Player)localObject1).reviveRequest((Player)paramCreature, d1, false);
  label318: label338: getEffects(paramCreature, localCreature, false, false);
}
if (isSSPossible())
  label341: paramCreature.unChargeShots(isMagic());
 }
}

 

может проще туда условие вбить?

если не участник осады и находишься в осадной зоне - претворись бревном... пока осада не пройдет.

Изменено пользователем Серый_Ветер

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


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

и так, теория научного тыка немного помогла:

имеем:

CastleSiegeEvent.class

Скрытый текст
package l2p.gameserver.model.entity.events.impl;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
import l2p.commons.collections.MultiValueSet;
import l2p.commons.dao.JdbcEntityState;
import l2p.commons.threading.RunnableImpl;
import l2p.gameserver.Config;
import l2p.gameserver.ThreadPoolManager;
import l2p.gameserver.dao.CastleDamageZoneDAO;
import l2p.gameserver.dao.CastleDoorUpgradeDAO;
import l2p.gameserver.dao.CastleHiredGuardDAO;
import l2p.gameserver.dao.SiegeClanDAO;
import l2p.gameserver.data.xml.holder.EventHolder;
import l2p.gameserver.instancemanager.ReflectionManager;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.Spawner;
import l2p.gameserver.model.Zone.ZoneType;
import l2p.gameserver.model.base.RestartType;
import l2p.gameserver.model.entity.Hero;
import l2p.gameserver.model.entity.Reflection;
import l2p.gameserver.model.entity.SevenSigns;
import l2p.gameserver.model.entity.events.EventType;
import l2p.gameserver.model.entity.events.objects.DoorObject;
import l2p.gameserver.model.entity.events.objects.SiegeClanObject;
import l2p.gameserver.model.entity.events.objects.SiegeToggleNpcObject;
import l2p.gameserver.model.entity.events.objects.SpawnExObject;
import l2p.gameserver.model.entity.events.objects.SpawnSimpleObject;
import l2p.gameserver.model.entity.residence.Castle;
import l2p.gameserver.model.instances.DoorInstance;
import l2p.gameserver.model.instances.residences.SiegeToggleNpcInstance;
import l2p.gameserver.model.items.ItemInstance;
import l2p.gameserver.model.pledge.Clan;
import l2p.gameserver.model.pledge.UnitMember;
import l2p.gameserver.serverpackets.L2GameServerPacket;
import l2p.gameserver.serverpackets.PlaySound;
import l2p.gameserver.serverpackets.SystemMessage2;
import l2p.gameserver.serverpackets.components.SystemMsg;
import l2p.gameserver.templates.item.support.MerchantGuard;
import l2p.gameserver.templates.spawn.SpawnRange;
import l2p.gameserver.utils.Location;
import org.napile.primitive.Containers;
import org.napile.primitive.sets.IntSet;
import org.napile.primitive.sets.impl.TreeIntSet;

public class CastleSiegeEvent extends SiegeEvent<Castle, SiegeClanObject>
{
 public static final int MAX_SIEGE_CLANS = 20;
 public static final long DAY_IN_MILISECONDS = 86400000L;
 public static final String DEFENDERS_WAITING = "defenders_waiting";
 public static final String DEFENDERS_REFUSED = "defenders_refused";
 public static final String CONTROL_TOWERS = "control_towers";
 public static final String FLAME_TOWERS = "flame_towers";
 public static final String BOUGHT_ZONES = "bought_zones";
 public static final String GUARDS = "guards";
 public static final String HIRED_GUARDS = "hired_guards";
 private IntSet _nextSiegeTimes = Containers.EMPTY_INT_SET;
 private Future<?> _nextSiegeDateSetTask = null;
 private boolean _firstStep = false;

 public CastleSiegeEvent(MultiValueSet<String> paramMultiValueSet)
 {
super(paramMultiValueSet);
 }

 public void initEvent()
 {
super.initEvent();
List localList = getObjects("doors");
addObjects("bought_zones", CastleDamageZoneDAO.getInstance().load(getResidence()));
Iterator localIterator = localList.iterator();
while (localIterator.hasNext())
{
  DoorObject localDoorObject = (DoorObject)localIterator.next();
  localDoorObject.setUpgradeValue(this, CastleDoorUpgradeDAO.getInstance().load(localDoorObject.getUId()));
  localDoorObject.getDoor().addListener(this._doorDeathListener);
}
 }

 public void processStep(Clan paramClan)
 {
Clan localClan = ((Castle)getResidence()).getOwner();
((Castle)getResidence()).changeOwner(paramClan);
Object localObject2;
Object localObject3;
if (localClan != null)
{
  SiegeClanObject localSiegeClanObject1 = getSiegeClan("defenders", localClan);
  removeObject("defenders", localSiegeClanObject1);
  localSiegeClanObject1.setType("attackers");
  addObject("attackers", localSiegeClanObject1);
}
else
{
  if ((getObjects("attackers").size() == 1) && (Config.CastleQuickSiege))
  {
	stopEvent();
	return;
  }
  int i = paramClan.getAllyId();
  if (i > 0)
  {
	localList = getObjects("attackers");
	int j = 1;
	localObject2 = localList.iterator();
	while (((Iterator)localObject2).hasNext())
	{
	  localObject3 = (SiegeClanObject)((Iterator)localObject2).next();
	  if ((localObject3 != null) && (((SiegeClanObject)localObject3).getClan().getAllyId() != i))
		j = 0;
	}
	if ((j != 0) && (Config.CastleQuickSiege))
	{
	  stopEvent();
	  return;
	}
  }
}
SiegeClanObject localSiegeClanObject2 = getSiegeClan("attackers", paramClan);
localSiegeClanObject2.deleteFlag();
localSiegeClanObject2.setType("defenders");
removeObject("attackers", localSiegeClanObject2);
List localList = removeObjects("defenders");
Object localObject1 = localList.iterator();
while (((Iterator)localObject1).hasNext())
{
  localObject2 = (SiegeClanObject)((Iterator)localObject1).next();
  ((SiegeClanObject)localObject2).setType("attackers");
}
addObject("defenders", localSiegeClanObject2);
addObjects("attackers", localList);
updateParticles(true, new String[] { "attackers", "defenders" });
teleportPlayers("attackers");
teleportPlayers("spectators");
if (!this._firstStep)
{
  this._firstStep = true;
  broadcastTo(SystemMsg.THE_TEMPORARY_ALLIANCE_OF_THE_CASTLE_ATTACKER_TEAM_HAS_BEEN_DISSOL
VED, new String[] { "attackers", "defenders" });
  if (this._oldOwner != null)
  {
	spawnAction("hired_guards", false);
	damageZoneAction(false);
	removeObjects("hired_guards");
	removeObjects("bought_zones");
	CastleDamageZoneDAO.getInstance().delete(getResidence());
  }
  else
  {
	spawnAction("guards", false);
  }
  localObject1 = getObjects("doors");
  localObject2 = ((List)localObject1).iterator();
  while (((Iterator)localObject2).hasNext())
  {
	localObject3 = (DoorObject)((Iterator)localObject2).next();
	((DoorObject)localObject3).setWeak(true);
	((DoorObject)localObject3).setUpgradeValue(this, 0);
	CastleDoorUpgradeDAO.getInstance().delete(((DoorObject)localObject3).getUId());
  }
}
spawnAction("doors", true);
despawnSiegeSummons();
 }

 public void startEvent()
 {
this._oldOwner = ((Castle)getResidence()).getOwner();
if (this._oldOwner != null)
{
  addObject("defenders", new SiegeClanObject("defenders", this._oldOwner, 0L));
  if (((Castle)getResidence()).getSpawnMerchantTickets().size() > 0)
  {
	localObject = ((Castle)getResidence()).getSpawnMerchantTickets().iterator();
	while (((Iterator)localObject).hasNext())
	{
	  ItemInstance localItemInstance = (ItemInstance)((Iterator)localObject).next();
	  MerchantGuard localMerchantGuard = ((Castle)getResidence()).getMerchantGuard(localItemInstance.getItemId());
	  addObject("hired_guards", new SpawnSimpleObject(localMerchantGuard.getNpcId(), localItemInstance.getLoc()));
	  localItemInstance.deleteMe();
	}
	CastleHiredGuardDAO.getInstance().delete(getResidence());
	spawnAction("hired_guards", true);
  }
}
Object localObject = getObjects("attackers");
if (((List)localObject).isEmpty())
{
  if (this._oldOwner == null)
	broadcastToWorld(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_INTEREST).addResidenceName(getResidence()));
  else
	broadcastToWorld(new SystemMessage2(SystemMsg.S1S_SIEGE_WAS_CANCELED_BECAUSE_THERE_WERE_NO_CLANS_THAT_PARTICIPAT
ED).addResidenceName(getResidence()));
  reCalcNextTime(false);
  return;
}
SiegeClanDAO.getInstance().delete(getResidence());
updateParticles(true, new String[] { "attackers", "defenders" });
broadcastTo(SystemMsg.THE_TEMPORARY_ALLIANCE_OF_THE_CASTLE_ATTACKER_TEAM_IS_IN_EFFECT, new String[] { "attackers" });
broadcastTo(new SystemMessage2(SystemMsg.YOU_ARE_PARTICIPATING_IN_THE_SIEGE_OF_S1_THIS_SIEGE_IS_SCHEDULED_F
OR_2_HOURS).addResidenceName(getResidence()), new String[] { "attackers", "defenders" });
super.startEvent();
if (this._oldOwner == null)
  initControlTowers();
else
  damageZoneAction(true);
 }

 public void stopEvent(boolean paramBoolean)
 {
List localList = getObjects("doors");
Object localObject1 = localList.iterator();
while (((Iterator)localObject1).hasNext())
{
  localObject2 = (DoorObject)((Iterator)localObject1).next();
  ((DoorObject)localObject2).setWeak(false);
}
damageZoneAction(false);
updateParticles(false, new String[] { "attackers", "defenders" });
localObject1 = removeObjects("attackers");
Object localObject2 = ((List)localObject1).iterator();
Object localObject3;
while (((Iterator)localObject2).hasNext())
{
  localObject3 = (SiegeClanObject)((Iterator)localObject2).next();
  ((SiegeClanObject)localObject3).deleteFlag();
}
broadcastToWorld(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_IS_FINISHED).addResidenceName(getResidence()));
removeObjects("defenders");
removeObjects("defenders_waiting");
removeObjects("defenders_refused");
localObject2 = ((Castle)getResidence()).getOwner();
if (localObject2 != null)
{
  if (this._oldOwner == localObject2)
  {
	((Castle)getResidence()).setRewardCount(((Castle)getResidence()).getRewardCount() + 1);
	((Clan)localObject2).broadcastToOnlineMembers(new L2GameServerPacket[] { new SystemMessage2(SystemMsg.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_B
EEN_ADDED_TO_YOUR_CLANS_REPUTATION_SCORE).addInteger(((Clan)localObject2).incReputation(1500, false, toString())) });
  }
  else
  {
	broadcastToWorld(((SystemMessage2)new SystemMessage2(SystemMsg.CLAN_S1_IS_VICTORIOUS_OVER_S2S_CASTLE_SIEGE).addString(((Clan)localObject2).getName())).addResidenceName(getResidence()));
	((Clan)localObject2).broadcastToOnlineMembers(new L2GameServerPacket[] { new SystemMessage2(SystemMsg.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_B
EEN_ADDED_TO_YOUR_CLANS_REPUTATION_SCORE).addInteger(((Clan)localObject2).incReputation(3000, false, toString())) });
	if (this._oldOwner != null)
	  this._oldOwner.broadcastToOnlineMembers(new L2GameServerPacket[] { new SystemMessage2(SystemMsg.YOUR_CLAN_HAS_FAILED_TO_DEFEND_THE_CASTLE_S1_POINTS_HAVE_BEEN_DEDU
CTED_FROM_YOU_CLAN_REPUTATION_SCORE_AND_ADDED_TO_YOUR_OPPONENTS).addInteger(-this._oldOwner.incReputation(-3000, false, toString())) });
	localObject3 = ((Clan)localObject2).iterator();
	while (((Iterator)localObject3).hasNext())
	{
	  UnitMember localUnitMember = (UnitMember)((Iterator)localObject3).next();
	  Player localPlayer = localUnitMember.getPlayer();
	  if (localPlayer != null)
	  {
		localPlayer.sendPacket(PlaySound.SIEGE_VICTORY);
		if ((localPlayer.isOnline()) && (localPlayer.isNoble()))
		  Hero.getInstance().addHeroDiary(localPlayer.getObjectId(), 3, ((Castle)getResidence()).getId());
	  }
	}
  }
  ((Castle)getResidence()).getOwnDate().setTimeInMillis(System.currentTimeMillis());
  ((Castle)getResidence()).getLastSiegeDate().setTimeInMillis(((Castle)getResidence()).getSiegeDate().getTimeInMillis());
  localObject3 = (DominionSiegeRunnerEvent)EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, 1);
  ((DominionSiegeRunnerEvent)localObject3).registerDominion(((Castle)getResidence()).getDominion());
}
else
{
  broadcastToWorld(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_HAS_ENDED_IN_A_DRAW).addResidenceName(getResidence()));
  ((Castle)getResidence()).getOwnDate().setTimeInMillis(0L);
  ((Castle)getResidence()).getLastSiegeDate().setTimeInMillis(0L);
  localObject3 = (DominionSiegeRunnerEvent)EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, 1);
  ((DominionSiegeRunnerEvent)localObject3).unRegisterDominion(((Castle)getResidence()).getDominion());
}
despawnSiegeSummons();
if (this._oldOwner != null)
{
  spawnAction("hired_guards", false);
  removeObjects("hired_guards");
}
super.stopEvent(paramBoolean);
 }

 public void reCalcNextTime(boolean paramBoolean)
 {
clearActions();
long l = System.currentTimeMillis();
Calendar localCalendar1 = ((Castle)getResidence()).getSiegeDate();
Calendar localCalendar2 = ((Castle)getResidence()).getOwnDate();
if (paramBoolean)
{
  if (localCalendar1.getTimeInMillis() > l)
	registerActions();
  else if (localCalendar1.getTimeInMillis() == 0L)
  {
	if (l - localCalendar2.getTimeInMillis() > 86400000L)
	  setNextSiegeTime();
	else
	  generateNextSiegeDates();
  }
  else if (localCalendar1.getTimeInMillis() <= l)
	setNextSiegeTime();
}
else if (((Castle)getResidence()).getOwner() != null)
{
  ((Castle)getResidence()).getSiegeDate().setTimeInMillis(0L);
  ((Castle)getResidence()).setJdbcState(JdbcEntityState.UPDATED);
  ((Castle)getResidence()).update();
  generateNextSiegeDates();
}
else
{
  setNextSiegeTime();
}
 }

 public void loadSiegeClans()
 {
super.loadSiegeClans();
addObjects("defenders_waiting", SiegeClanDAO.getInstance().load(getResidence(), "defenders_waiting"));
addObjects("defenders_refused", SiegeClanDAO.getInstance().load(getResidence(), "defenders_refused"));
 }

 public void setRegistrationOver(boolean paramBoolean)
 {
if (paramBoolean)
  broadcastToWorld(new SystemMessage2(SystemMsg.THE_DEADLINE_TO_REGISTER_FOR_THE_SIEGE_OF_S1_HAS_PASSED).addResidenceName(getResidence()));
super.setRegistrationOver(paramBoolean);
 }

 public void announce(int paramInt)
 {
int i = paramInt / 60;
int j = i / 60;
SystemMessage2 localSystemMessage2;
if (j > 0)
  localSystemMessage2 = (SystemMessage2)new SystemMessage2(SystemMsg.S1_HOURS_UNTIL_CASTLE_SIEGE_CONCLUSION).addInteger(j);
else if (i > 0)
  localSystemMessage2 = (SystemMessage2)new SystemMessage2(SystemMsg.S1_MINUTES_UNTIL_CASTLE_SIEGE_CONCLUSION).addInteger(i);
else
  localSystemMessage2 = (SystemMessage2)new SystemMessage2(SystemMsg.THIS_CASTLE_SIEGE_WILL_END_IN_S1_SECONDS).addInteger(paramInt);
broadcastTo(localSystemMessage2, new String[] { "attackers", "defenders" });
 }

 private void initControlTowers()
 {
List localList = getObjects("guards");
ArrayList localArrayList = new ArrayList();
Object localObject1 = localList.iterator();
Object localObject2;
while (((Iterator)localObject1).hasNext())
{
  localObject2 = (SpawnExObject)((Iterator)localObject1).next();
  localArrayList.addAll(((SpawnExObject)localObject2).getSpawns());
}
localObject1 = getObjects("control_towers");
Iterator localIterator1 = localArrayList.iterator();
while (localIterator1.hasNext())
{
  Spawner localSpawner = (Spawner)localIterator1.next();
  Location localLocation = localSpawner.getCurrentSpawnRange().getRandomLoc(ReflectionManager.DEFAULT.getGeoIndex());
  localObject2 = null;
  double d2 = 0.0D;
  Iterator localIterator2 = ((List)localObject1).iterator();
  while (localIterator2.hasNext())
  {
	SiegeToggleNpcObject localSiegeToggleNpcObject = (SiegeToggleNpcObject)localIterator2.next();
	SiegeToggleNpcInstance localSiegeToggleNpcInstance = localSiegeToggleNpcObject.getToggleNpc();
	double d1 = localSiegeToggleNpcInstance.getDistance(localLocation);
	if ((localObject2 == null) || (d1 < d2))
	{
	  localObject2 = localSiegeToggleNpcInstance;
	  d2 = d1;
	}
	((SiegeToggleNpcInstance)localObject2).register(localSpawner);
  }
}
 }

 private void damageZoneAction(boolean paramBoolean)
 {
zoneAction("bought_zones", paramBoolean);
 }

 public void generateNextSiegeDates()
 {
if (((Castle)getResidence()).getSiegeDate().getTimeInMillis() != 0L)
  return;
Calendar localCalendar = (Calendar)Config.CASTLE_VALIDATION_DATE.clone();
localCalendar.set(7, 1);
if (localCalendar.before(Config.CASTLE_VALIDATION_DATE))
  localCalendar.add(3, 1);
validateSiegeDate(localCalendar, 2);
this._nextSiegeTimes = new TreeIntSet();
for (int k : Config.CASTLE_SELECT_HOURS)
{
  localCalendar.set(11, k);
  this._nextSiegeTimes.add((int)(localCalendar.getTimeInMillis() / 1000L));
}
long l = ((Castle)getResidence()).getOwnDate().getTimeInMillis() + 86400000L - System.currentTimeMillis();
this._nextSiegeDateSetTask = ThreadPoolManager.getInstance().schedule(new NextSiegeDateSet(null), l);
 }

 public void setNextSiegeTime(int paramInt)
 {
if ((!this._nextSiegeTimes.contains(paramInt)) || (this._nextSiegeDateSetTask == null))
  return;
this._nextSiegeTimes = Containers.EMPTY_INT_SET;
this._nextSiegeDateSetTask.cancel(false);
this._nextSiegeDateSetTask = null;
setNextSiegeTime(paramInt * 1000L);
 }

 private void setNextSiegeTime()
 {
Calendar localCalendar = (Calendar)Config.CASTLE_VALIDATION_DATE.clone();
localCalendar.set(7, this._dayOfWeek);
localCalendar.set(11, this._hourOfDay);
if (localCalendar.before(Config.CASTLE_VALIDATION_DATE))
  localCalendar.add(3, 1);
validateSiegeDate(localCalendar, 2);
setNextSiegeTime(localCalendar.getTimeInMillis());
 }

 private void setNextSiegeTime(long paramLong)
 {
broadcastToWorld(new SystemMessage2(SystemMsg.S1_HAS_ANNOUNCED_THE_NEXT_CASTLE_SIEGE_TIME).addResidenceName(getResidence()));
clearActions();
((Castle)getResidence()).getSiegeDate().setTimeInMillis(paramLong);
((Castle)getResidence()).setJdbcState(JdbcEntityState.UPDATED);
((Castle)getResidence()).update();
registerActions();
 }

 public boolean isAttackersInAlly()
 {
return !this._firstStep;
 }

 public int[] getNextSiegeTimes()
 {
return this._nextSiegeTimes.toArray();
 }

 public boolean canRessurect(Player paramPlayer, Creature paramCreature, boolean paramBoolean)
 {
boolean bool1 = paramPlayer.isInZone(Zone.ZoneType.SIEGE);
boolean bool2 = paramCreature.isInZone(Zone.ZoneType.SIEGE);
if ((!bool1) && (!bool2))
  return true;
if (!bool2)
  return false;
Player localPlayer = paramCreature.getPlayer();
CastleSiegeEvent localCastleSiegeEvent = (CastleSiegeEvent)paramCreature.getEvent(CastleSiegeEvent.class);
if (localCastleSiegeEvent != this)
{
  if (paramBoolean)
	localPlayer.sendPacket(SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_
IS_TAKING_PLACE);
  paramPlayer.sendPacket(paramBoolean ? SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_IS_T
AKING_PLACE : SystemMsg.INVALID_TARGET);
  return false;
}
SiegeClanObject localSiegeClanObject = localCastleSiegeEvent.getSiegeClan("attackers", localPlayer.getClan());
if (localSiegeClanObject == null)
  localSiegeClanObject = localCastleSiegeEvent.getSiegeClan("defenders", localPlayer.getClan());
if (localSiegeClanObject.getType() == "attackers")
{
  if (localSiegeClanObject.getFlag() == null)
  {
	if (paramBoolean)
	  localPlayer.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
	paramPlayer.sendPacket(paramBoolean ? SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE : SystemMsg.INVALID_TARGET);
	return false;
  }
}
else
{
  List localList = getObjects("control_towers");
  int i = 1;
  Iterator localIterator = localList.iterator();
  while (localIterator.hasNext())
  {
	SiegeToggleNpcObject localSiegeToggleNpcObject = (SiegeToggleNpcObject)localIterator.next();
	if (!localSiegeToggleNpcObject.isAlive())
	  i = 0;
  }
  if (i == 0)
  {
	if (paramBoolean)
	  localPlayer.sendPacket(SystemMsg.THE_GUARDIAN_TOWER_HAS_BEEN_DESTROYED_AND_RESURRECTION_IS_NOT_POSS
IBLE);
	paramPlayer.sendPacket(paramBoolean ? SystemMsg.THE_GUARDIAN_TOWER_HAS_BEEN_DESTROYED_AND_RESURRECTION_IS_NOT_POSSIBLE : SystemMsg.INVALID_TARGET);
  }
}
if (paramBoolean)
  return true;
paramPlayer.sendPacket(SystemMsg.INVALID_TARGET);
return false;
 }

 public Location getRestartLoc(Player paramPlayer, RestartType paramRestartType)
 {
Location localLocation = null;
switch (1.$SwitchMap$l2p$gameserver$model$base$RestartType[paramRestartType.ordinal()])
{
case 1:
  if (SevenSigns.getInstance().getSealOwner(3) != 2)
	break;
  localLocation = ((Castle)this._residence).getNotOwnerRestartPoint(paramPlayer);
}
return localLocation;
 }

 private class NextSiegeDateSet extends RunnableImpl
 {
private NextSiegeDateSet()
{
}

public void runImpl()
  throws Exception
{
  CastleSiegeEvent.this.setNextSiegeTime();
}
 }
}

 

где есть описание canRessurect и описываются те кто атакуют и защищают.

есть описание только нападающие и защищаюшиеся

а также описание "наблюдающих"...

так вот там есть:

Скрытый текст
public boolean canRessurect(Player paramPlayer, Creature paramCreature, boolean paramBoolean)
 {
boolean bool1 = paramPlayer.isInZone(Zone.ZoneType.SIEGE);
boolean bool2 = paramCreature.isInZone(Zone.ZoneType.SIEGE);
if ((!bool1) && (!bool2))
  return true;
if (!bool2)
  return false;
Player localPlayer = paramCreature.getPlayer();
CastleSiegeEvent localCastleSiegeEvent = (CastleSiegeEvent)paramCreature.getEvent(CastleSiegeEvent.class);
if (localCastleSiegeEvent != this)
{
  if (paramBoolean)
	localPlayer.sendPacket(SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_
IS_TAKING_PLACE);
  paramPlayer.sendPacket(paramBoolean ? SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_IS_T
AKING_PLACE : SystemMsg.INVALID_TARGET);
  return false;
}
SiegeClanObject localSiegeClanObject = localCastleSiegeEvent.getSiegeClan("attackers", localPlayer.getClan());
if (localSiegeClanObject == null)
  localSiegeClanObject = localCastleSiegeEvent.getSiegeClan("defenders", localPlayer.getClan());
if (localSiegeClanObject.getType() == "attackers")
{
  if (localSiegeClanObject.getFlag() == null)
  {
	if (paramBoolean)
	  localPlayer.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
	paramPlayer.sendPacket(paramBoolean ? SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE : SystemMsg.INVALID_TARGET);
	return false;
  }
}
else
{
  List localList = getObjects("control_towers");
  int i = 1;
  Iterator localIterator = localList.iterator();
  while (localIterator.hasNext())
  {
	SiegeToggleNpcObject localSiegeToggleNpcObject = (SiegeToggleNpcObject)localIterator.next();
	if (!localSiegeToggleNpcObject.isAlive())
	  i = 0;
  }
  if (i == 0)
  {
	if (paramBoolean)
	  localPlayer.sendPacket(SystemMsg.THE_GUARDIAN_TOWER_HAS_BEEN_DESTROYED_AND_RESURRECTION_IS_NOT_POSS
IBLE);
	paramPlayer.sendPacket(paramBoolean ? SystemMsg.THE_GUARDIAN_TOWER_HAS_BEEN_DESTROYED_AND_RESURRECTION_IS_NOT_POSSIBLE : SystemMsg.INVALID_TARGET);
  }
}
if (paramBoolean)
  return true;
paramPlayer.sendPacket(SystemMsg.INVALID_TARGET);
return false;
 }

 

как сюда внести еще то чтобы в зоне также не работали свитки... так как скил не работает, что верно если судить из описания и подтвержденное на опыте :)

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


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

блин, 60 просмотров...

и никто не мог сказать что код то битый....

 

и вообще, хай пока так...

а я пошел книжки по яве читать...

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


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

лучше днем эти темы апать или напиши в личку iceman он шарит

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


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

днем я на работе. :(

 

но в личку отписал, спасибо.

Изменено пользователем Серый_Ветер

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


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

в общем, благодаря этому

сравнил декомпил..

дела однако.....

получается теряем всю инфы в скобках, условия if есть, но чего сравнивать нету в паре случаев.

остальной код в идеале сохранен, окромя точек с запятой.

то есть у ворона эта часть без изменений была.

уже что то чем ничего...

лишь бы тока значения были теже самые

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


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

нарыл такой кусок кода:

				Player targetPlayer = target.getPlayer();
			// если таргет не с нашей осады(или вообще нету осады) - рес запрещен
			CastleSiegeEvent siegeEvent = target.getEvent(CastleSiegeEvent.class);
			if(siegeEvent != this)
			{
					if(force)
							targetPlayer.sendPacket(SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_
IS_TAKING_PLACE);
					resurrectPlayer.sendPacket(force ? SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_IS_T
AKING_PLACE : SystemMsg.INVALID_TARGET);
					return false;
			}

 

получается здесь выделенная цель сравнивается..

а как сравнить того кто наводит цель?

 

весь файло целиком:

 

 

package org.mmocore.gameserver.model.entity.events.impl;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.Future;

import org.mmocore.commons.collections.MultiValueSet;
import org.mmocore.commons.dao.JdbcEntityState;
import org.mmocore.commons.threading.RunnableImpl;
import org.mmocore.gameserver.Config;
import org.mmocore.gameserver.ThreadPoolManager;
import org.mmocore.gameserver.dao.CastleDamageZoneDAO;
import org.mmocore.gameserver.dao.CastleDoorUpgradeDAO;
import org.mmocore.gameserver.dao.CastleHiredGuardDAO;
import org.mmocore.gameserver.dao.SiegeClanDAO;
import org.mmocore.gameserver.data.xml.holder.EventHolder;
import org.mmocore.gameserver.instancemanager.ReflectionManager;
import org.mmocore.gameserver.model.Creature;
import org.mmocore.gameserver.model.Player;
import org.mmocore.gameserver.model.Spawner;
import org.mmocore.gameserver.model.Zone;
import org.mmocore.gameserver.model.base.RestartType;
import org.mmocore.gameserver.model.entity.Hero;
import org.mmocore.gameserver.model.entity.HeroDiary;
import org.mmocore.gameserver.model.entity.SevenSigns;
import org.mmocore.gameserver.model.entity.events.EventType;
import org.mmocore.gameserver.model.entity.events.objects.DoorObject;
import org.mmocore.gameserver.model.entity.events.objects.SiegeClanObject;
import org.mmocore.gameserver.model.entity.events.objects.SiegeToggleNpcObject;
import org.mmocore.gameserver.model.entity.events.objects.SpawnExObject;
import org.mmocore.gameserver.model.entity.events.objects.SpawnSimpleObject;
import org.mmocore.gameserver.model.entity.residence.Castle;
import org.mmocore.gameserver.model.instances.residences.SiegeToggleNpcInstance;
import org.mmocore.gameserver.model.items.ItemInstance;
import org.mmocore.gameserver.model.pledge.Clan;
import org.mmocore.gameserver.model.pledge.UnitMember;
import org.mmocore.gameserver.network.l2.components.SystemMsg;
import org.mmocore.gameserver.network.l2.s2c.PlaySound;
import org.mmocore.gameserver.network.l2.s2c.SystemMessage2;
import org.mmocore.gameserver.templates.item.support.MerchantGuard;
import org.mmocore.gameserver.utils.Location;
import org.napile.primitive.Containers;
import org.napile.primitive.sets.IntSet;
import org.napile.primitive.sets.impl.TreeIntSet;

/**
* @author VISTALL
* @date 15:12/14.02.2011
*/
public class CastleSiegeEvent extends SiegeEvent<Castle, SiegeClanObject>
{
private class NextSiegeDateSet extends RunnableImpl
{
	@Override
	public void runImpl() throws Exception
	{
		setNextSiegeTime();
	}
}

public static final int MAX_SIEGE_CLANS = 20;
public static final long DAY_IN_MILISECONDS = 86400000L;

public static final String DEFENDERS_WAITING = "defenders_waiting";
public static final String DEFENDERS_REFUSED = "defenders_refused";

public static final String CONTROL_TOWERS	= "control_towers";
public static final String FLAME_TOWERS		= "flame_towers";
public static final String BOUGHT_ZONES		= "bought_zones";
public static final String GUARDS			= "guards";
public static final String HIRED_GUARDS		= "hired_guards";

private IntSet _nextSiegeTimes = Containers.EMPTY_INT_SET;
private Future<?> _nextSiegeDateSetTask = null;
private boolean _firstStep = false;

public CastleSiegeEvent(MultiValueSet<String> set)
{
	super(set);
}

//================================================================================
================================================================================
=
=======
//													Длавные методы осады
//================================================================================
================================================================================
=
=======
@Override
public void initEvent()
{
	super.initEvent();

	List<DoorObject> doorObjects = getObjects(DOORS);

	addObjects(BOUGHT_ZONES, CastleDamageZoneDAO.getInstance().load(getResidence()));

	for(DoorObject doorObject : doorObjects)
	{
		doorObject.setUpgradeValue(this, CastleDoorUpgradeDAO.getInstance().load(doorObject.getUId()));
		doorObject.getDoor().addListener(_doorDeathListener);
	}
}

@Override
public void processStep(Clan newOwnerClan)
{
	Clan oldOwnerClan = getResidence().getOwner();

	getResidence().changeOwner(newOwnerClan);

	// если есть овнер в резиденции, делаем его аттакером
	if(oldOwnerClan != null)
	{
		SiegeClanObject ownerSiegeClan = getSiegeClan(DEFENDERS, oldOwnerClan);
		removeObject(DEFENDERS, ownerSiegeClan);

		ownerSiegeClan.setType(ATTACKERS);
		addObject(ATTACKERS, ownerSiegeClan);
	}
	else
	{
		// Если атакуется замок, принадлежащий NPC, и только 1 атакующий - закончить осаду
		if(getObjects(ATTACKERS).size() == 1)
		{
			stopEvent();
			return;
		}

		// Если атакуется замок, принадлежащий NPC, и все атакующие в одном альянсе - закончить осаду
		int allianceObjectId = newOwnerClan.getAllyId();
		if(allianceObjectId > 0)
		{
			List<SiegeClanObject> attackers = getObjects(ATTACKERS);
			boolean sameAlliance = true;
			for(SiegeClanObject sc : attackers)
				if(sc != null && sc.getClan().getAllyId() != allianceObjectId)
					sameAlliance = false;
			if(sameAlliance)
			{
				stopEvent();
				return;
			}
		}
	}

	// ставим нового овнера защитником
	SiegeClanObject newOwnerSiegeClan = getSiegeClan(ATTACKERS, newOwnerClan);
	newOwnerSiegeClan.deleteFlag();
	newOwnerSiegeClan.setType(DEFENDERS);

	removeObject(ATTACKERS, newOwnerSiegeClan);

	// у нас защитник ток овнер
	List<SiegeClanObject> defenders = removeObjects(DEFENDERS);
	for(SiegeClanObject siegeClan : defenders)
		siegeClan.setType(ATTACKERS);

	// новый овнер это защитник
	addObject(DEFENDERS, newOwnerSiegeClan);

	// все дефендеры, стают аттакующими
	addObjects(ATTACKERS, defenders);

	updateParticles(true, ATTACKERS, DEFENDERS);

	teleportPlayers(ATTACKERS);
	teleportPlayers(SPECTATORS);

	// ток при первом захвате обнуляем мерчант гвардов и убираем апгрейд дверей
	if(!_firstStep)
	{
		_firstStep = true;

		broadcastTo(SystemMsg.THE_TEMPORARY_ALLIANCE_OF_THE_CASTLE_ATTACKER_TEAM_HAS_BEEN_DISSOL
VED, ATTACKERS, DEFENDERS);

		if(_oldOwner != null)
		{
			spawnAction(HIRED_GUARDS, false);
			damageZoneAction(false);
			removeObjects(HIRED_GUARDS);
			removeObjects(BOUGHT_ZONES);

			CastleDamageZoneDAO.getInstance().delete(getResidence());
		}
		else
			spawnAction(GUARDS, false);

		List<DoorObject> doorObjects = getObjects(DOORS);
		for(DoorObject doorObject : doorObjects)
		{
			doorObject.setWeak(true);
			doorObject.setUpgradeValue(this, 0);

			CastleDoorUpgradeDAO.getInstance().delete(doorObject.getUId());
		}
	}

	spawnAction(DOORS, true);
	despawnSiegeSummons();
}

@Override
public void startEvent()
{
	_oldOwner = getResidence().getOwner();
	if(_oldOwner != null)
	{
		addObject(DEFENDERS, new SiegeClanObject(DEFENDERS, _oldOwner, 0));

		if(getResidence().getSpawnMerchantTickets().size() > 0)
		{
			for(ItemInstance item : getResidence().getSpawnMerchantTickets())
			{
				MerchantGuard guard = getResidence().getMerchantGuard(item.getItemId());

				addObject(HIRED_GUARDS, new SpawnSimpleObject(guard.getNpcId(), item.getLoc()));

				item.deleteMe();
			}

			CastleHiredGuardDAO.getInstance().delete(getResidence());

			spawnAction(HIRED_GUARDS, true);
		}
	}

	List<SiegeClanObject> attackers = getObjects(ATTACKERS);
	if(attackers.isEmpty())
	{
		if(_oldOwner == null)
			broadcastToWorld(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_INTEREST).addResidenceName(getResidence()));
		else
			broadcastToWorld(new SystemMessage2(SystemMsg.S1S_SIEGE_WAS_CANCELED_BECAUSE_THERE_WERE_NO_CLANS_THAT_PARTICIPAT
ED).addResidenceName(getResidence()));

		reCalcNextTime(false);
		return;
	}

	SiegeClanDAO.getInstance().delete(getResidence());

	updateParticles(true, ATTACKERS, DEFENDERS);

	broadcastTo(SystemMsg.THE_TEMPORARY_ALLIANCE_OF_THE_CASTLE_ATTACKER_TEAM_IS_IN_EFFECT, ATTACKERS);
	broadcastTo(new SystemMessage2(SystemMsg.YOU_ARE_PARTICIPATING_IN_THE_SIEGE_OF_S1_THIS_SIEGE_IS_SCHEDULED_F
OR_2_HOURS).addResidenceName(getResidence()), ATTACKERS, DEFENDERS);

	super.startEvent();

	if(_oldOwner == null)
		initControlTowers();
	else
		damageZoneAction(true);
}

@Override
public void stopEvent(boolean step)
{
	List<DoorObject> doorObjects = getObjects(DOORS);
	for(DoorObject doorObject : doorObjects)
		doorObject.setWeak(false);

	damageZoneAction(false);

	updateParticles(false, ATTACKERS, DEFENDERS);

	List<SiegeClanObject> attackers = removeObjects(ATTACKERS);
	for(SiegeClanObject siegeClan : attackers)
		siegeClan.deleteFlag();

	broadcastToWorld(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_IS_FINISHED).addResidenceName(getResidence()));

	removeObjects(DEFENDERS);
	removeObjects(DEFENDERS_WAITING);
	removeObjects(DEFENDERS_REFUSED);

	Clan ownerClan = getResidence().getOwner();
	if(ownerClan != null)
	{
		if(_oldOwner == ownerClan)
		{
			getResidence().setRewardCount(getResidence().getRewardCount() + 1);
			ownerClan.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_B
EEN_ADDED_TO_YOUR_CLANS_REPUTATION_SCORE).addInteger(ownerClan.incReputation(1500, false, toString())));
		}
		else
		{
			broadcastToWorld(new SystemMessage2(SystemMsg.CLAN_S1_IS_VICTORIOUS_OVER_S2S_CASTLE_SIEGE).addString(ownerClan.getName()).addResidenceName(getResidence()));

			ownerClan.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_B
EEN_ADDED_TO_YOUR_CLANS_REPUTATION_SCORE).addInteger(ownerClan.incReputation(3000, false, toString())));

			if(_oldOwner != null)
				_oldOwner.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.YOUR_CLAN_HAS_FAILED_TO_DEFEND_THE_CASTLE_S1_POINTS_HAVE_BEEN_DEDU
CTED_FROM_YOU_CLAN_REPUTATION_SCORE_AND_ADDED_TO_YOUR_OPPONENTS).addInteger(-_oldOwner.incReputation(-3000, false, toString())));

			for(UnitMember member : ownerClan)
			{
				Player player = member.getPlayer();
				if(player != null )
				{
					player.sendPacket(PlaySound.SIEGE_VICTORY);
					if(player.isOnline() && player.isNoble())
						Hero.getInstance().addHeroDiary(player.getObjectId(), HeroDiary.ACTION_CASTLE_TAKEN, getResidence().getId());
				}
			}
		}

		getResidence().getOwnDate().setTimeInMillis(System.currentTimeMillis());
		getResidence().getLastSiegeDate().setTimeInMillis(getResidence().getSiegeDate().getTimeInMillis());

		DominionSiegeRunnerEvent runnerEvent = EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, 1);
		runnerEvent.registerDominion(getResidence().getDominion());
	}
	else
	{
		broadcastToWorld(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_HAS_ENDED_IN_A_DRAW).addResidenceName(getResidence()));

		getResidence().getOwnDate().setTimeInMillis(0);
		getResidence().getLastSiegeDate().setTimeInMillis(0);

		DominionSiegeRunnerEvent runnerEvent = EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, 1);
		runnerEvent.unRegisterDominion(getResidence().getDominion());
	}

	despawnSiegeSummons();

	if(_oldOwner != null)
	{
		spawnAction(HIRED_GUARDS, false);
		removeObjects(HIRED_GUARDS);
	}

	super.stopEvent(step);
}
//================================================================================
================================================================================
=
=======

@Override
public void reCalcNextTime(boolean onInit)
{
	clearActions();

	final long currentTimeMillis = System.currentTimeMillis();
	final Calendar startSiegeDate = getResidence().getSiegeDate();
	final Calendar ownSiegeDate = getResidence().getOwnDate();
	if(onInit)
	{
		if(startSiegeDate.getTimeInMillis() > currentTimeMillis)
			registerActions();
		else if(startSiegeDate.getTimeInMillis() == 0)
		{
			if((currentTimeMillis - ownSiegeDate.getTimeInMillis()) > DAY_IN_MILISECONDS) // прошол день после осады
				setNextSiegeTime();
			else
				generateNextSiegeDates();
		}
		else if(startSiegeDate.getTimeInMillis() <= currentTimeMillis)
			setNextSiegeTime();
	}
	else
	{
		if(getResidence().getOwner() != null)
		{
			getResidence().getSiegeDate().setTimeInMillis(0);
			getResidence().setJdbcState(JdbcEntityState.UPDATED);
			getResidence().update();

			generateNextSiegeDates();
		}
		else
			setNextSiegeTime();
	}
}

@Override
public void loadSiegeClans()
{
	super.loadSiegeClans();

	addObjects(DEFENDERS_WAITING, SiegeClanDAO.getInstance().load(getResidence(), DEFENDERS_WAITING));
	addObjects(DEFENDERS_REFUSED, SiegeClanDAO.getInstance().load(getResidence(), DEFENDERS_REFUSED));
}

@Override
public void setRegistrationOver(boolean b)
{
	if(b)
		broadcastToWorld(new SystemMessage2(SystemMsg.THE_DEADLINE_TO_REGISTER_FOR_THE_SIEGE_OF_S1_HAS_PASSED).addResidenceName(getResidence()));

	super.setRegistrationOver(b);
}

@Override
public void announce(int val)
{
	SystemMessage2 msg;
	int min = val / 60;
	int hour = min / 60;

	if(hour > 0)
		msg = new SystemMessage2(SystemMsg.S1_HOURS_UNTIL_CASTLE_SIEGE_CONCLUSION).addInteger(hour);
	else if(min > 0)
		msg = new SystemMessage2(SystemMsg.S1_MINUTES_UNTIL_CASTLE_SIEGE_CONCLUSION).addInteger(min);
	else
		msg = new SystemMessage2(SystemMsg.THIS_CASTLE_SIEGE_WILL_END_IN_S1_SECONDS).addInteger(val);

	broadcastTo(msg, ATTACKERS, DEFENDERS);
}
//================================================================================
================================================================================
=
=======
//												   Control Tower Support
//================================================================================
================================================================================
=
=======
private void initControlTowers()
{
	List<SpawnExObject> objects = getObjects(GUARDS);
	List<Spawner> spawns = new ArrayList<Spawner>();
	for(SpawnExObject o : objects)
		spawns.addAll(o.getSpawns());

	List<SiegeToggleNpcObject> ct = getObjects(CONTROL_TOWERS);

	SiegeToggleNpcInstance closestCt;
	double distance, distanceClosest;

	for(Spawner spawn : spawns)
	{
		Location spawnLoc = spawn.getCurrentSpawnRange().getRandomLoc(ReflectionManager.DEFAULT.getGeoIndex());

		closestCt = null;
		distanceClosest = 0;

		for(SiegeToggleNpcObject c : ct)
		{
			SiegeToggleNpcInstance npcTower = c.getToggleNpc();
			distance = npcTower.getDistance(spawnLoc);

			if(closestCt == null || distance < distanceClosest)
			{
				closestCt = npcTower;
				distanceClosest = distance;
			}

			closestCt.register(spawn);
		}
	}
}
//================================================================================
================================================================================
=
=======
//													Damage Zone Actions
//================================================================================
================================================================================
=
=======
private void damageZoneAction(boolean active)
{
	zoneAction(BOUGHT_ZONES, active);
}
//================================================================================
================================================================================
=
=======
//													Суппорт Методы для установки времени осады
//================================================================================
================================================================================
=
=======
/**
 * Денерирует даты для следующей осады замка, и запускает таймер на автоматическую установку даты
 */
public void generateNextSiegeDates()
{
	if(getResidence().getSiegeDate().getTimeInMillis() != 0)
		return;

	final Calendar calendar = (Calendar) Config.CASTLE_VALIDATION_DATE.clone();
	calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
	if(calendar.before(Config.CASTLE_VALIDATION_DATE))
		calendar.add(Calendar.WEEK_OF_YEAR, 1);
	validateSiegeDate(calendar, 2);

	_nextSiegeTimes = new TreeIntSet();

	for(int h : Config.CASTLE_SELECT_HOURS)
	{
		calendar.set(Calendar.HOUR_OF_DAY, h);
		_nextSiegeTimes.add((int) (calendar.getTimeInMillis() / 1000L));
	}

	long diff = (getResidence().getOwnDate().getTimeInMillis() + DAY_IN_MILISECONDS) - System.currentTimeMillis();
	_nextSiegeDateSetTask = ThreadPoolManager.getInstance().schedule(new NextSiegeDateSet(), diff);
}

/**
 * Ставит осадное время вручну, вызывается с пакета {@link org.mmocore.gameserver.network.l2.c2s.RequestSetCastleSiegeTime}
 * @param id
 */
public void setNextSiegeTime(int id)
{
	if(!_nextSiegeTimes.contains(id) || _nextSiegeDateSetTask == null)
		return;

	_nextSiegeTimes = Containers.EMPTY_INT_SET;
	_nextSiegeDateSetTask.cancel(false);
	_nextSiegeDateSetTask = null;

	setNextSiegeTime(id * 1000L);
}

/**
 * Автоматически генерит и устанавливает дату осады
 */
private void setNextSiegeTime()
{
	final Calendar calendar = (Calendar) Config.CASTLE_VALIDATION_DATE.clone();
	calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
	calendar.set(Calendar.HOUR_OF_DAY, getResidence().getLastSiegeDate().get(Calendar.HOUR_OF_DAY));
	if(calendar.before(Config.CASTLE_VALIDATION_DATE))
		calendar.add(Calendar.WEEK_OF_YEAR, 1);
	validateSiegeDate(calendar, 2);

	setNextSiegeTime(calendar.getTimeInMillis());
}
/**
 * Ставит дату осады, запускает действия, аннонсирует по миру
 * @param g
 */
private void setNextSiegeTime(long g)
{
	broadcastToWorld(new SystemMessage2(SystemMsg.S1_HAS_ANNOUNCED_THE_NEXT_CASTLE_SIEGE_TIME).addResidenceName(getResidence()));

	clearActions();

	getResidence().getSiegeDate().setTimeInMillis(g);
	getResidence().setJdbcState(JdbcEntityState.UPDATED);
	getResidence().update();

	registerActions();
}

@Override
public boolean isAttackersInAlly()
{
	return !_firstStep;
}

public int[] getNextSiegeTimes()
{
	return _nextSiegeTimes.toArray();
}

@Override
public boolean canRessurect(Player resurrectPlayer, Creature target, boolean force)
{
	boolean playerInZone = resurrectPlayer.isInZone(Zone.ZoneType.SIEGE);
	boolean targetInZone = target.isInZone(Zone.ZoneType.SIEGE);
	// если оба вне зоны - рес разрешен
	if(!playerInZone && !targetInZone)
		return true;
	// если таргет вне осадный зоны - рес разрешен
	if(!targetInZone)
		return true;
	if (!playerInZone && targetInZone)
		return false;

	Player target = target.getPlayer();
	// если таргет не с нашей осады(или вообще нету осады) - рес запрещен
	CastleSiegeEvent siegeEvent = target.getEvent(CastleSiegeEvent.class);
	if(siegeEvent != this)
	{
		if(force)
			targetPlayer.sendPacket(SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_
IS_TAKING_PLACE);
		resurrectPlayer.sendPacket(force ? SystemMsg.IT_IS_NOT_POSSIBLE_TO_RESURRECT_IN_BATTLEFIELDS_WHERE_A_SIEGE_WAR_IS_T
AKING_PLACE : SystemMsg.INVALID_TARGET);
		return false;
	}
	//Проверка на возможность воскрешения, если воскрешающий игрок, не зарегестрирован на осаду (буду делать ток)

	SiegeClanObject targetSiegeClan = siegeEvent.getSiegeClan(ATTACKERS, targetPlayer.getClan());
	if(targetSiegeClan == null)
		targetSiegeClan = siegeEvent.getSiegeClan(DEFENDERS, targetPlayer.getClan());

	if(targetSiegeClan.getType() == ATTACKERS)
	{
		// если нету флага - рес запрещен
		if(targetSiegeClan.getFlag() == null)
		{
			if(force)
				targetPlayer.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
			resurrectPlayer.sendPacket(force ? SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE : SystemMsg.INVALID_TARGET);
			return false;
		}
	}
	else
	{
		List<SiegeToggleNpcObject> towers = getObjects(CastleSiegeEvent.CONTROL_TOWERS);

		boolean canRes = true;
		for(SiegeToggleNpcObject t : towers)
			if(!t.isAlive())
				canRes = false;

		if(!canRes)
		{
			if(force)
				targetPlayer.sendPacket(SystemMsg.THE_GUARDIAN_TOWER_HAS_BEEN_DESTROYED_AND_RESURRECTION_IS_NOT_POSS
IBLE);
			resurrectPlayer.sendPacket(force ? SystemMsg.THE_GUARDIAN_TOWER_HAS_BEEN_DESTROYED_AND_RESURRECTION_IS_NOT_POSSIBLE : SystemMsg.INVALID_TARGET);
		}
	}

	if(force)
		return true;
	else
	{
		resurrectPlayer.sendPacket(SystemMsg.INVALID_TARGET);
		return false;
	}
}

@Override
public Location getRestartLoc(Player player, RestartType type)
{
	Location loc = null;
	switch(type)
	{
		case TO_VILLAGE:
			// Если печатью владеют лорды Рассвета (Dawn), и в данном городе идет осада, то телепортирует во 2-й по счету город.
			if(SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
				loc = _residence.getNotOwnerRestartPoint(player);
			break;
	}

	return loc;
}
}

 

 

 

эй, кто спойлеры поломал?

Изменено пользователем Серый_Ветер

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


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

Отыщи такого пользователя как Akumu он прекрасно знает ядро оверлорда

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


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

открпал кучу всего, и с помощью и без...

подскажите в чем глюки?

 

SiegeEvent.java

 

package org.mmocore.gameserver.model.entity.events.impl;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

import org.mmocore.commons.collections.LazyArrayList;
import org.mmocore.commons.collections.MultiValueSet;
import org.mmocore.commons.dao.JdbcEntityState;
import org.mmocore.commons.lang.reference.HardReference;
import org.mmocore.commons.util.Rnd;
import org.mmocore.gameserver.dao.SiegeClanDAO;
import org.mmocore.gameserver.data.xml.holder.ResidenceHolder;
import org.mmocore.gameserver.instancemanager.ReflectionManager;
import org.mmocore.gameserver.listener.actor.OnDeathListener;
import org.mmocore.gameserver.listener.actor.OnKillListener;
import org.mmocore.gameserver.model.Creature;
import org.mmocore.gameserver.model.GameObject;
import org.mmocore.gameserver.model.Player;
import org.mmocore.gameserver.model.Skill;
import org.mmocore.gameserver.model.base.RestartType;
import org.mmocore.gameserver.model.entity.events.GlobalEvent;
import org.mmocore.gameserver.model.entity.events.objects.SiegeClanObject;
import org.mmocore.gameserver.model.entity.events.objects.ZoneObject;
import org.mmocore.gameserver.model.entity.residence.Residence;
import org.mmocore.gameserver.model.instances.DoorInstance;
import org.mmocore.gameserver.model.instances.SummonInstance;
import org.mmocore.gameserver.model.pledge.Clan;
import org.mmocore.gameserver.network.l2.components.IStaticPacket;
import org.mmocore.gameserver.network.l2.components.SystemMsg;
import org.mmocore.gameserver.network.l2.s2c.L2GameServerPacket;
import org.mmocore.gameserver.network.l2.s2c.RelationChanged;
import org.mmocore.gameserver.tables.ClanTable;
import org.mmocore.gameserver.templates.DoorTemplate;
import org.mmocore.gameserver.utils.Location;
import org.mmocore.gameserver.utils.TimeUtils;

/**
* @author VISTALL
* @date 15:11/14.02.2011
*
* TODO:
* - п╬я│п╟пЄпҐя▀п╧ пЁп╬п╩п╣п╪ skill id: 13 пІя─п╣я┌ пҐп╟ я└п╦пЇп╣ 30 я│п╬я│п╬п╨, 0 пҐп╟ п╪п╟пЁ
*/
public abstract class SiegeEvent<R extends Residence, S extends SiegeClanObject> extends GlobalEvent
{
	public class DoorDeathListener implements OnDeathListener
	{
			@Override
			public void onDeath(Creature actor, Creature killer)
			{
					if(!isInProgress())
							return;

					DoorInstance door = (DoorInstance)actor;
					if(door.getDoorType() == DoorTemplate.DoorType.WALL)
							return;

					broadcastTo(SystemMsg.THE_CASTLE_GATE_HAS_BEEN_DESTROYED, SiegeEvent.ATTACKERS, SiegeEvent.DEFENDERS);
			}
	}

	public class KillListener implements OnKillListener
	{
			@Override
			public void onKill(Creature actor, Creature victim)
			{
					Player winner = actor.getPlayer();

					if(winner == null || !victim.isPlayer() || winner.getLevel() < 40 || winner == victim || victim.getEvent(SiegeEvent.this.getClass()) != SiegeEvent.this || !checkIfInZone(actor) || !checkIfInZone(victim))
							return;

					winner.setFame(winner.getFame() + Rnd.get(10, 20), SiegeEvent.this.toString());
			}

			@Override
			public boolean ignorePetOrSummon()
			{
					return true;
			}
	}

	public static final String OWNER = "owner";
	public static final String OLD_OWNER = "old_owner";

	public static final String ATTACKERS = "attackers";
	public static final String DEFENDERS = "defenders";
	public static final String SPECTATORS = "spectators";

	public static final String SIEGE_ZONES = "siege_zones";
	public static final String FLAG_ZONES = "flag_zones";

	public static final String DAY_OF_WEEK = "day_of_week";
	public static final String HOUR_OF_DAY = "hour_of_day";

	public static final String REGISTRATION = "registration";

	public static final String DOORS = "doors";

	protected R _residence;

	private boolean _isInProgress;
	private boolean _isRegistrationOver;

	protected int _dayOfWeek;
	protected int _hourOfDay;

	protected Clan _oldOwner;

	protected OnKillListener _killListener = new KillListener();
	protected OnDeathListener _doorDeathListener = new DoorDeathListener();
	protected List<HardReference<SummonInstance>> _siegeSummons = new ArrayList<HardReference<SummonInstance>>();

	public SiegeEvent(MultiValueSet<String> set)
	{
			super(set);
			_dayOfWeek = set.getInteger(DAY_OF_WEEK, 0);
			_hourOfDay = set.getInteger(HOUR_OF_DAY, 0);
	}


	@Override
	public void startEvent()
	{
			setInProgress(true);

			super.startEvent();
	}

	@Override
	public final void stopEvent()
	{
			stopEvent(false);
	}

	public void stopEvent(boolean step)
	{
			despawnSiegeSummons();
			setInProgress(false);
			reCalcNextTime(false);

			super.stopEvent();
	}

	public void processStep(Clan clan)
	{
	}

	@Override
	public void reCalcNextTime(boolean onInit)
	{
			clearActions();

			final Calendar startSiegeDate = getResidence().getSiegeDate();
			if(onInit)
			{
					if(startSiegeDate.getTimeInMillis() <= System.currentTimeMillis())
					{
							startSiegeDate.set(Calendar.DAY_OF_WEEK, _dayOfWeek);
							startSiegeDate.set(Calendar.HOUR_OF_DAY, _hourOfDay);

							validateSiegeDate(startSiegeDate, 2);
							getResidence().setJdbcState(JdbcEntityState.UPDATED);
					}
			}
			else
			{
					startSiegeDate.add(Calendar.WEEK_OF_YEAR, 2);
					getResidence().setJdbcState(JdbcEntityState.UPDATED);
			}

			registerActions();

			getResidence().update();
	}

	protected void validateSiegeDate(Calendar calendar, int add)
	{
			calendar.set(Calendar.MINUTE, 0);
			calendar.set(Calendar.SECOND, 0);
			calendar.set(Calendar.MILLISECOND, 0);

			while(calendar.getTimeInMillis() < System.currentTimeMillis())
					calendar.add(Calendar.WEEK_OF_YEAR, add);
	}

	@Override
	protected long startTimeMillis()
	{
			return getResidence().getSiegeDate().getTimeInMillis();
	}

	@Override
	public void teleportPlayers(String t)
	{
			List<Player> players = new ArrayList<Player>();
			Clan ownerClan = getResidence().getOwner();
			if(t.equalsIgnoreCase(OWNER))
			{
					if(ownerClan != null)
							for(Player player : getPlayersInZone())
									if(player.getClan() == ownerClan)
											players.add(player);
			}
			else if(t.equalsIgnoreCase(ATTACKERS))
			{
					for(Player player : getPlayersInZone())
					{
							S siegeClan = getSiegeClan(ATTACKERS, player.getClan());
							if(siegeClan != null && siegeClan.isParticle(player))
									players.add(player);
					}
			}
			else if(t.equalsIgnoreCase(DEFENDERS))
			{
					for(Player player : getPlayersInZone())
					{
							if(ownerClan != null && player.getClan() != null && player.getClan() == ownerClan)
									continue;

							S siegeClan = getSiegeClan(DEFENDERS, player.getClan());
							if(siegeClan != null && siegeClan.isParticle(player))
									players.add(player);
					}
			}
			else if(t.equalsIgnoreCase(SPECTATORS))
			{
					for(Player player : getPlayersInZone())
					{
							if(ownerClan != null && player.getClan() != null && player.getClan() == ownerClan)
									continue;

							if(player.getClan() == null || getSiegeClan(ATTACKERS, player.getClan()) == null && getSiegeClan(DEFENDERS, player.getClan()) == null)
									players.add(player);
					}
			}
			else
					players = getPlayersInZone();

			for(Player player : players)
			{
					Location loc = null;
					if(t.equalsIgnoreCase(OWNER) || t.equalsIgnoreCase(DEFENDERS))
							loc = getResidence().getOwnerRestartPoint();
					else
							loc = getResidence().getNotOwnerRestartPoint(player);

					player.teleToLocation(loc, ReflectionManager.DEFAULT);
			}
	}

	public List<Player> getPlayersInZone()
	{
			List<ZoneObject> zones = getObjects(SIEGE_ZONES);
			List<Player> result = new LazyArrayList<Player>();
			for(ZoneObject zone : zones)
					result.addAll(zone.getInsidePlayers());
			return result;
	}

	public void broadcastInZone(L2GameServerPacket... packet)
	{
			for(Player player : getPlayersInZone())
					player.sendPacket(packet);
	}

	public void broadcastInZone(IStaticPacket... packet)
	{
			for(Player player : getPlayersInZone())
					player.sendPacket(packet);
	}

	public boolean checkIfInZone(Creature character)
	{
			List<ZoneObject> zones = getObjects(SIEGE_ZONES);
					for(ZoneObject zone : zones)
							if(zone.checkIfInZone(character))
									return true;
			return false;
	}

	public void broadcastInZone2(IStaticPacket... packet)
	{
			for(Player player : getResidence().getZone().getInsidePlayers())
					player.sendPacket(packet);
	}

	public void broadcastInZone2(L2GameServerPacket... packet)
	{
			for(Player player : getResidence().getZone().getInsidePlayers())
					player.sendPacket(packet);
	}
	public void loadSiegeClans()
	{
			addObjects(ATTACKERS, SiegeClanDAO.getInstance().load(getResidence(), ATTACKERS));
			addObjects(DEFENDERS, SiegeClanDAO.getInstance().load(getResidence(), DEFENDERS));
	}

	@SuppressWarnings("unchecked")
	public S newSiegeClan(String type, int clanId, long param, long date)
	{
			Clan clan = ClanTable.getInstance().getClan(clanId);
			return clan == null ? null : (S) new SiegeClanObject(type, clan, param, date);
	}

	public void updateParticles(boolean start, String... arg)
	{
			for(String a : arg)
			{
					List<SiegeClanObject> siegeClans = getObjects(a);
					for(SiegeClanObject s : siegeClans)
							s.setEvent(start, this);
			}
	}

	@SuppressWarnings("unchecked")
	public S getSiegeClan(String name, Clan clan)
	{
			if(clan == null)
					return null;
			return getSiegeClan(name, clan.getClanId());
	}

	@SuppressWarnings("unchecked")
	public S getSiegeClan(String name, int objectId)
	{
			List<SiegeClanObject> siegeClanList = getObjects(name);
			if(siegeClanList.isEmpty())
					return null;
			for(int i = 0; i < siegeClanList.size(); i++)
			{
					SiegeClanObject siegeClan = siegeClanList.get(i);
					if(siegeClan.getObjectId() == objectId)
							return (S) siegeClan;
			}
			return null;
	}

	public void broadcastTo(IStaticPacket packet, String... types)
	{
			for(String type : types)
			{
					List<SiegeClanObject> siegeClans = getObjects(type);
					for(SiegeClanObject siegeClan : siegeClans)
							siegeClan.broadcast(packet);
			}
	}

	public void broadcastTo(L2GameServerPacket packet, String... types)
	{
			for(String type : types)
			{
					List<SiegeClanObject> siegeClans = getObjects(type);
					for(SiegeClanObject siegeClan : siegeClans)
							siegeClan.broadcast(packet);
			}
	}


	@Override
	@SuppressWarnings("unchecked")
	public void initEvent()
	{
			_residence = (R) ResidenceHolder.getInstance().getResidence(getId());

			loadSiegeClans();

			clearActions();

			super.initEvent();
	}

	@Override
	protected void printInfo()
	{
			final long startSiegeMillis = startTimeMillis();

			if(startSiegeMillis == 0)
					info(getName() + " time - undefined");
			else
					info(getName() + " time - " + TimeUtils.toSimpleFormat(startSiegeMillis));
	}

	@Override
	public boolean ifVar(String name)
	{
			if(name.equals(OWNER))
					return getResidence().getOwner() != null;
			if(name.equals(OLD_OWNER))
					return _oldOwner != null;

			return false;
	}

	@Override
	public boolean isParticle(Player player)
	{
			if(!isInProgress() || player.getClan() == null)
					return false;
			return getSiegeClan(ATTACKERS, player.getClan()) != null || getSiegeClan(DEFENDERS, player.getClan()) != null;
	}

	@Override
	public void checkRestartLocs(Player player, Map<RestartType, Boolean> r)
	{
			if(getObjects(FLAG_ZONES).isEmpty())
					return;

			S clan = getSiegeClan(ATTACKERS, player.getClan());
			if(clan != null)
					if(clan.getFlag() != null)
							r.put(RestartType.TO_FLAG, Boolean.TRUE);
	}

	@Override
	public Location getRestartLoc(Player player, RestartType type)
	{
			S attackerClan = getSiegeClan(ATTACKERS, player.getClan());

			Location loc = null;
			switch(type)
			{
					case TO_FLAG:
							if(!getObjects(FLAG_ZONES).isEmpty() && attackerClan != null && attackerClan.getFlag() != null)
									loc = Location.findPointToStay(attackerClan.getFlag(), 50, 75);
							else
									player.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
							break;
			}

			return loc;
	}

	@Override
	public int getRelation(Player thisPlayer, Player targetPlayer, int result)
	{
			Clan clan1 = thisPlayer.getClan();
			Clan clan2 = targetPlayer.getClan();
			if(clan1 == null || clan2 == null)
					return result;

			SiegeEvent<?, ?> siegeEvent2 = targetPlayer.getEvent(SiegeEvent.class);
			if(this == siegeEvent2)
			{
					result |= RelationChanged.RELATION_INSIEGE;

					SiegeClanObject siegeClan1 = getSiegeClan(SiegeEvent.ATTACKERS, clan1);
					SiegeClanObject siegeClan2 = getSiegeClan(SiegeEvent.ATTACKERS, clan2);

					if(siegeClan1 == null && siegeClan2 == null || siegeClan1 != null && siegeClan2 != null && isAttackersInAlly())
							result |= RelationChanged.RELATION_ALLY;
					else
							result |= RelationChanged.RELATION_ENEMY;
					if(siegeClan1 != null)
							result |= RelationChanged.RELATION_ATTACKER;
			}

			return result;
	}

	@Override
	public int getUserRelation(Player thisPlayer, int oldRelation)
	{
			SiegeClanObject siegeClan = getSiegeClan(SiegeEvent.ATTACKERS, thisPlayer.getClan());
			if(siegeClan != null)
					oldRelation |= 0x180;
			else
					oldRelation |= 0x80;
			return oldRelation;
	}

	@Override
	public SystemMsg checkForAttack(Creature target, Creature attacker, Skill skill, boolean force)
	{
			SiegeEvent<?, ?> siegeEvent = target.getEvent(SiegeEvent.class);

			if(this != siegeEvent)
					return null;
			if(!checkIfInZone(target) || !checkIfInZone(attacker))
					return null;

			Player player = target.getPlayer();
			if(player == null)
					return null;

			SiegeClanObject siegeClan1 = getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
			if(siegeClan1 == null && attacker.isSiegeGuard())
					return SystemMsg.INVALID_TARGET;
			Player playerAttacker = attacker.getPlayer();
			if(playerAttacker == null)
					return SystemMsg.INVALID_TARGET;

			SiegeClanObject siegeClan2 = getSiegeClan(SiegeEvent.ATTACKERS, playerAttacker.getClan());
			if(siegeClan1 != null && siegeClan2 != null && isAttackersInAlly())
					return SystemMsg.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_
SIEGE;
			if(siegeClan1 == null && siegeClan2 == null)
					return SystemMsg.INVALID_TARGET;

			return null;
	}

	@Override
	public boolean isInProgress()
	{
			return _isInProgress;
	}

	@Override
	public void action(String name, boolean start)
	{
			if(name.equalsIgnoreCase(REGISTRATION))
					setRegistrationOver(!start);
			else
					super.action(name, start);
	}

	public boolean isAttackersInAlly()
	{
			return false;
	}

	@Override
	public void onAddEvent(GameObject object)
	{
			if(_killListener == null)
					return;

			if(object.isPlayer())
					((Player)object).addListener(_killListener);
	}

	@Override
	public void onRemoveEvent(GameObject object)
	{
			if(_killListener == null)
					return;

			if(object.isPlayer())
					((Player)object).removeListener(_killListener);
	}

	@Override
	public List<Player> broadcastPlayers(int range)
	{
			return itemObtainPlayers();
	}

	@Override
	public List<Player> itemObtainPlayers()
	{
			List<Player> playersInZone = getPlayersInZone();

			List<Player> list = new LazyArrayList<Player>(playersInZone.size());
			for(Player player : getPlayersInZone())
			{
					if(player.getEvent(getClass()) == this)
							list.add(player);
			}
			return list;
	}

	public Location getEnterLoc(Player player)
	{
			S siegeClan = getSiegeClan(ATTACKERS, player.getClan());
			if(siegeClan != null)
			{
					if(siegeClan.getFlag() != null)
							return Location.findAroundPosition(siegeClan.getFlag(), 50, 75);
					else
							return getResidence().getNotOwnerRestartPoint(player);
			}
			else
					return getResidence().getOwnerRestartPoint();
	}

	public R getResidence()
	{
			return _residence;
	}

	public void setInProgress(boolean b)
	{
			_isInProgress = b;
	}

	public boolean isRegistrationOver()
	{
			return _isRegistrationOver;
	}

	public void setRegistrationOver(boolean b)
	{
			_isRegistrationOver = b;
	}
	public void addSiegeSummon(SummonInstance summon)
	{
			_siegeSummons.add(summon.getRef());
	}

	public boolean containsSiegeSummon(SummonInstance cha)
	{
			return _siegeSummons.contains(cha.getRef());
	}

	public void despawnSiegeSummons()
	{
			for(HardReference<SummonInstance> ref : _siegeSummons)
			{
					SummonInstance summon = ref.get();
					if(summon != null)
							summon.unSummon();
			}
			_siegeSummons.clear();
	}
}

 

 

тут есть расчет реса у флага:

		@Override
	public Location getRestartLoc(Player player, RestartType type)
	{
			S attackerClan = getSiegeClan(ATTACKERS, player.getClan());

			Location loc = null;
			switch(type)
			{
					case TO_FLAG:
							if(!getObjects(FLAG_ZONES).isEmpty() && attackerClan != null && attackerClan.getFlag() != null)
									loc = Location.findPointToStay(attackerClan.getFlag(), 50, 75);
							else
									player.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
							break;
			}

			return loc;
	}

а в CastleSiegeEvent.java расчет в деревне

		@Override
	public Location getRestartLoc(Player player, RestartType type)
	{
			Location loc = null;
			switch(type)
			{
					case TO_VILLAGE:
							if(SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
									loc = _residence.getNotOwnerRestartPoint(player);
							break;
			}

			return loc;
	}

 

как можно объединить?

мпорт не помог...

дописывание одного в другое вообще не компилируется проект

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


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

добавь в пакет Revive.java, чтобы точно знать какие функции участвуют

 

Throwable t = new Throwable();

t.printStackTrace();

 

 

 

а так CastleSiegeEvent наследуется от SiegeEvent и поэтому getRestartLoc(Player player, RestartType type) перегружается

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


Ссылка на сообщение
Поделиться на другие сайты
а так CastleSiegeEvent наследуется от SiegeEvent и поэтому getRestartLoc(Player player, RestartType type) перегружается.

 

то есть?

 

к case TO_FLAG из SiegeEvent.java добавляется case TO_VILLAGE: из CastleSiegeEvent.java ?

или заменятеся одно другим?

 

как именно добавить в Revive.java

добавил пока так:

 

Скрытый текст
> cat Revive.java
package org.mmocore.gameserver.network.l2.s2c;

import org.mmocore.gameserver.model.GameObject;

/**
* sample
* 0000: 0c  9b da 12 40									 ....@
*
* format  d
*/
public class Revive extends L2GameServerPacket
{
	private int _objectId;

	public Revive(GameObject obj)
	{
			_objectId = obj.getObjectId();

			Throwable t = new Throwable();
			t.printStackTrace();
	}

	@Override
	protected final void writeImpl()
	{
			writeC(0x01);
			writeD(_objectId);
	}
}>

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


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

полностью заменяется

 

http://ru.wikipedia.org/wiki/%D0%9F%D0%B5%...%BE%D0%B4%D0%B0

 

правильно добавил, после реса появится ошибка, в которой будет вызов всех функций, сюда скопируй

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


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

[22:06:18]  INFO CastleSiegeEvent: Undefined objects: bought_zones
java.lang.Throwable
<------>at org.mmocore.gameserver.network.l2.s2c.Revive.<init>(Revive.java:19)
<------>at org.mmocore.gameserver.model.Playable.doRevive(Playable.java:590)
<------>at org.mmocore.gameserver.model.Player.doRevive(Player.java:6917)
<------>at org.mmocore.gameserver.model.Player.onTeleported(Player.java:5915)
<------>at org.mmocore.gameserver.network.l2.c2s.Appearing.runImpl(Appearing.java:42)
<------>at org.mmocore.gameserver.network.l2.c2s.L2GameClientPacket.run(L2GameClientPacket.java:50)
<------>at org.mmocore.commons.net.nio.impl.MMOExecutableQueue.run(MMOExecutableQueue.java:38)
<------>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
<------>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
<------>at java.lang.Thread.run(Thread.java:722)
java.lang.Throwable
<------>at org.mmocore.gameserver.network.l2.s2c.Revive.<init>(Revive.java:19)
<------>at org.mmocore.gameserver.model.Playable.doRevive(Playable.java:590)
<------>at org.mmocore.gameserver.model.Player.doRevive(Player.java:6917)
<------>at org.mmocore.gameserver.model.Player.onTeleported(Player.java:5915)
<------>at org.mmocore.gameserver.network.l2.c2s.Appearing.runImpl(Appearing.java:42)
<------>at org.mmocore.gameserver.network.l2.c2s.L2GameClientPacket.run(L2GameClientPacket.java:50)
<------>at org.mmocore.commons.net.nio.impl.MMOExecutableQueue.run(MMOExecutableQueue.java:38)
<------>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
<------>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
<------>at java.lang.Thread.run(Thread.java:722)

 

полностью заменяется/

тогда понятно почему не робит к флагу :lol: его затирают:)

Изменено пользователем Серый_Ветер

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


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

в RequestRestartPoint.java

if(ref == ReflectionManager.DEFAULT)
  for(GlobalEvent e : activeChar.getEvents())
  loc = e.getRestartLoc(activeChar, _restartType);

 

и т.к. последний евент похоже и есть CastleSiegeEvent, поэтому добавляй в метод getRestartLoc из CastleSiegeEvent

 

case TO_FLAG:
  if(!getObjects(FLAG_ZONES).isEmpty() && attackerClan != null && attackerClan.getFlag() != null)
  loc = Location.findPointToStay(attackerClan.getFlag(), 50, 75);
  else
  player.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
  break;

Изменено пользователем qwe923

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


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

default:
Location loc = null;
Reflection ref = activeChar.getReflection();

if(ref == ReflectionManager.DEFAULT)
for(GlobalEvent e : activeChar.getEvents())
loc = e.getRestartLoc(activeChar, _restartType);

if(loc == null)
loc = defaultLoc(_restartType, activeChar);

if(loc != null)
{
Pair<Integer, OnAnswerListener> ask = activeChar.getAskListener(false);
if(ask != null && ask.getValue() instanceof ReviveAnswerListener && !((ReviveAnswerListene
activeChar.getAskListener(true);

activeChar.setPendingRevive(true);
activeChar.teleToLocation(loc, ReflectionManager.DEFAULT);
}

ужо есть такое.

 

и т.к. последний евент похоже и есть CastleSiegeEvent, поэтому добавляй в метод getRestartLoc из CastleSiegeEvent

 

кхе...

я уже пытался сделать так.

 

ругается:

Скрытый текст
compile-gameserver:
  [delete] Deleting directory /home/l2serv/source/overworld/source/over/build/classes
[mkdir] Created dir: /home/l2serv/source/overworld/source/over/build/classes
[javac] /home/l2serv/source/overworld/source/over/build.xml:84: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1658 source files to /home/l2serv/source/overworld/source/over/build/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/residence/Castle.java:740: warning: [unchecked] unchecked conversion
[javac]			 List<Fortress> list = _relatedFortresses.get(Fortress.DOMAIN);
[javac]														 ^
[javac]   required: List<Fortress>
[javac]   found:	List
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/GameServer.java:282: warning: [unchecked] unchecked conversion
[javac]			 _selectorThreads = new SelectorThread[Config.PORTS_GAME.length];
[javac]								^
[javac]   required: SelectorThread<GameClient>[]
[javac]   found:	SelectorThread[]
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:203: warning: [unchecked] unchecked cast
[javac]											 ((Set<Player>) info[0]).add(p);
[javac]																^
[javac]   required: Set<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:209: warning: [unchecked] unchecked cast
[javac]											 ((Set<Player>) info[0]).add(p);
[javac]																^
[javac]   required: Set<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:212: warning: [unchecked] unchecked cast
[javac]							 ((Set<Player>) info[0]).add(player);
[javac]												^
[javac]   required: Set<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:219: warning: [unchecked] unchecked cast
[javac]					 Set<Player> players = (HashSet<Player>) groupInfo[0];
[javac]																	  ^
[javac]   required: HashSet<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/events/impl/CastleSiegeEvent.java:609: error: cannot find symbol
[javac]							 if(!getObjects(FLAG_ZONES).isEmpty() && attackerClan != null && attackerClan.getFlag() != null)
[javac]																	 ^
[javac]   symbol:   variable attackerClan
[javac]   location: class CastleSiegeEvent
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/events/impl/CastleSiegeEvent.java:609: error: cannot find symbol
[javac]							 if(!getObjects(FLAG_ZONES).isEmpty() && attackerClan != null && attackerClan.getFlag() != null)
[javac]																							 ^
[javac]   symbol:   variable attackerClan
[javac]   location: class CastleSiegeEvent
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/events/impl/CastleSiegeEvent.java:610: error: cannot find symbol
[javac]									 loc = Location.findPointToStay(attackerClan.getFlag(), 50, 75);
[javac]																	^
[javac]   symbol:   variable attackerClan
[javac]   location: class CastleSiegeEvent
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/network/l2/s2c/ExReceiveOlympiad.java:73: warning: [unchecked] unchecked conversion
[javac]			 private List<PlayerInfo>[] _players = new ArrayList[2];
[javac]												   ^
[javac]   required: List<PlayerInfo>[]
[javac]   found:	ArrayList[]
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 3 errors
[javac] 8 warnings

BUILD FAILED
/home/l2serv/source/overworld/source/over/build.xml:84: Compile failed; see the compiler error output for details.

Total time: 7 seconds
>

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


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

если сделать наоборот. убрать из CastleSiegeEvent и добавить в SiegeEvent

 

то пишет так:

 

Скрытый текст
compile-gameserver:
  [delete] Deleting directory /home/l2serv/source/overworld/source/over/build/classes
[mkdir] Created dir: /home/l2serv/source/overworld/source/over/build/classes
[javac] /home/l2serv/source/overworld/source/over/build.xml:84: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1658 source files to /home/l2serv/source/overworld/source/over/build/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/residence/Castle.java:740: warning: [unchecked] unchecked conversion
[javac]			 List<Fortress> list = _relatedFortresses.get(Fortress.DOMAIN);
[javac]														 ^
[javac]   required: List<Fortress>
[javac]   found:	List
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/events/impl/SiegeEvent.java:445: error: cannot find symbol
[javac]							 if(SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
[javac]																	  ^
[javac]   symbol:   variable SevenSigns
[javac]   location: class SiegeEvent<R,S>
[javac]   where R,S are type-variables:
[javac]	 R extends Residence declared in class SiegeEvent
[javac]	 S extends SiegeClanObject declared in class SiegeEvent
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/events/impl/SiegeEvent.java:445: error: cannot find symbol
[javac]							 if(SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
[javac]								^
[javac]   symbol:   variable SevenSigns
[javac]   location: class SiegeEvent<R,S>
[javac]   where R,S are type-variables:
[javac]	 R extends Residence declared in class SiegeEvent
[javac]	 S extends SiegeClanObject declared in class SiegeEvent
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/entity/events/impl/SiegeEvent.java:445: error: cannot find symbol
[javac]							 if(SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
[javac]																								 ^
[javac]   symbol:   variable SevenSigns
[javac]   location: class SiegeEvent<R,S>
[javac]   where R,S are type-variables:
[javac]	 R extends Residence declared in class SiegeEvent
[javac]	 S extends SiegeClanObject declared in class SiegeEvent
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/GameServer.java:282: warning: [unchecked] unchecked conversion
[javac]			 _selectorThreads = new SelectorThread[Config.PORTS_GAME.length];
[javac]								^
[javac]   required: SelectorThread<GameClient>[]
[javac]   found:	SelectorThread[]
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:203: warning: [unchecked] unchecked cast
[javac]											 ((Set<Player>) info[0]).add(p);
[javac]																^
[javac]   required: Set<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:209: warning: [unchecked] unchecked cast
[javac]											 ((Set<Player>) info[0]).add(p);
[javac]																^
[javac]   required: Set<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:212: warning: [unchecked] unchecked cast
[javac]							 ((Set<Player>) info[0]).add(player);
[javac]												^
[javac]   required: Set<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/model/instances/RaidBossInstance.java:219: warning: [unchecked] unchecked cast
[javac]					 Set<Player> players = (HashSet<Player>) groupInfo[0];
[javac]																	  ^
[javac]   required: HashSet<Player>
[javac]   found:	Object
[javac] /home/l2serv/source/overworld/source/over/gameserver/src/main/java/org/mmocore/gameserver/network/l2/s2c/ExReceiveOlympiad.java:73: warning: [unchecked] unchecked conversion
[javac]			 private List<PlayerInfo>[] _players = new ArrayList[2];
[javac]												   ^
[javac]   required: List<PlayerInfo>[]
[javac]   found:	ArrayList[]
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 3 errors
[javac] 8 warnings

BUILD FAILED
/home/l2serv/source/overworld/source/over/build.xml:84: Compile failed; see the compiler error output for details.

Total time: 7 seconds

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


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

CastleSiegeEvent

Скрытый текст

public Location getRestartLoc(Player player, RestartType type)
{
	SiegeClanObject attackerClan = getSiegeClan(ATTACKERS, player.getClan());

	Location loc = null;
	switch(type)
	{
		case TO_VILLAGE:
			if(SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
				loc = _residence.getNotOwnerRestartPoint(player);
			break;

		case TO_FLAG:
			if(!getObjects(FLAG_ZONES).isEmpty() && attackerClan != null && attackerClan.getFlag() != null)
				loc = Location.findPointToStay(attackerClan.getFlag(), 50, 75);
			else
				player.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
			break;
	}

	return loc;
}

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


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

работает...

ОГРОМНОЕ спасибо.

 

нашел еще багу... причем где то в условиях if else после установки флага.

 

если флага нет, то соблюдены все условия:

ресать могут только свои, чужие - не могут

 

если флаг есть, ситуация меняется наоборот.

чужие могут, свои нет.

 

думал бага из-за внесенного кода, ан нет, в исходах такая же бяка...

 

 

явно где то в коде ! лишний....

 

ток где :D

 

смотрю

if(targetSiegeClan.getType() == ATTACKERS)
<------><------>{
<------><------><------>// если нету флага - рес запрещен
<------><------><------>if(targetSiegeClan.getFlag() == null)
<------><------><------>{
<------><------><------><------>if(force)
<------><------><------><------><------>targetPlayer.sendPacket(SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE);
<------><------><------><------><------>resurrectPlayer.sendPacket(force ? SystemMsg.IF_A_BASE_CAMP_DOES_NOT_EXIST_RESURRECTION_IS_NOT_POSSIBLE : SystemMsg.I
<------><------><------><------>return false;
<------><------><------>}
<------><------>}

 

вроде все првильно...

в чем глюк тогда...

Изменено пользователем Серый_Ветер

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


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

начал сам ковырять..

правда пока что све равно требуется помощь:

как и в прошлом случае, запихав в revive пару строк (выше в теме есть)

 

при отсутствии флага:

java.lang.Throwable

<------>at org.mmocore.gameserver.network.l2.s2c.Revive.<init>(Revive.java:18)

<------>at org.mmocore.gameserver.model.Playable.doRevive(Playable.java:590)

<------>at org.mmocore.gameserver.model.Player.doRevive(Player.java:6917)

<------>at org.mmocore.gameserver.model.Player.doRevive(Player.java:6911)

<------>at org.mmocore.gameserver.network.l2.c2s.RequestRestartPoint.runImpl(RequestRestart

Point.java:70)

<------>at org.mmocore.gameserver.network.l2.c2s.L2GameClientPacket.run(L2GameClientPacket.

java:50)

<------>at org.mmocore.commons.net.nio.impl.MMOExecutableQueue.run(MMOExecutableQueue.java:

38)

<------>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

<------>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

<------>at java.lang.Thread.run(Thread.java:722)

 

при наличии флага:

java.lang.Throwable

<------>at org.mmocore.gameserver.network.l2.s2c.Revive.<init>(Revive.java:18)

<------>at org.mmocore.gameserver.model.Playable.doRevive(Playable.java:590)

<------>at org.mmocore.gameserver.model.Player.doRevive(Player.java:6917)

<------>at org.mmocore.gameserver.model.Player.doRevive(Player.java:6911)

<------>at org.mmocore.gameserver.listener.actor.player.impl.ReviveAnswerListener.sayYes(Re

viveAnswerListener.java:35)

<------>at org.mmocore.gameserver.network.l2.c2s.ConfirmDlg.runImpl(ConfirmDlg.java:32)

<------>at org.mmocore.gameserver.network.l2.c2s.L2GameClientPacket.run(L2GameClientPacket.

java:50)

<------>at org.mmocore.commons.net.nio.impl.MMOExecutableQueue.run(MMOExecutableQueue.java:

38)

<------>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

<------>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

<------>at java.lang.Thread.run(Thread.java:722)

 

разница только в этих строчках...

вызываются разные методы похоже...

мне копать что именно надо?

 

метод sayYes:

Скрытый текст
<------>@Override
<------>public void sayYes()
<------>{
<------><------>Player player = _playerRef.get();
<------><------>if(player == null)
<------><------><------>return;
<------><------>if(!player.isDead() && !_forPet || _forPet && player.getPet() != null && !player.getPet().isDead())
<------><------><------>return;

<------><------>if(!_forPet)
<------><------><------>player.doRevive(_power);
<------><------>else if(player.getPet() != null)
<------><------><------>((PetInstance) player.getPet()).doRevive(_power);
<------>}

 

тут какбе(вроде как) про питомцев или нет?

 

второй вроде как все понятно:

Скрытый текст
public class RequestRestartPoint extends L2GameClientPacket
{
	private RestartType _restartType;

	@Override
	protected void readImpl()
	{
			_restartType = ArrayUtils.valid(RestartType.VALUES, readD());
	}

	@Override
	protected void runImpl()
	{
			Player activeChar = getClient().getActiveChar();

			if(_restartType == null || activeChar == null)
					return;

			if(activeChar.isFakeDeath())
			{
					activeChar.breakFakeDeath();
					return;
			}

			if(!activeChar.isDead() && !activeChar.isGM())
			{
					activeChar.sendActionFailed();
					return;
			}

			if(activeChar.isFestivalParticipant())
			{
					activeChar.doRevive();
					return;
			}

			switch(_restartType)
			{
					case AGATHION:
							if(activeChar.isAgathionResAvailable())
									activeChar.doRevive(100);
							else
									activeChar.sendPacket(ActionFail.STATIC, new Die(activeChar));
							break;
					case FIXED:
							if(activeChar.getPlayerAccess().ResurectFixed)
									activeChar.doRevive(100);
							else if(ItemFunctions.removeItem(activeChar, 13300, 1, true) == 1)
							{
									activeChar.sendPacket(SystemMsg.YOU_HAVE_USED_THE_FEATHER_OF_BLESSING_TO_RESURRECT);
									activeChar.doRevive(100);
							}
							else if(ItemFunctions.removeItem(activeChar, 10649, 1, true) == 1)
							{
									activeChar.sendPacket(SystemMsg.YOU_HAVE_USED_THE_FEATHER_OF_BLESSING_TO_RESURRECT);
									activeChar.doRevive(100);
							}
							else
									activeChar.sendPacket(ActionFail.STATIC, new Die(activeChar));
							break;
					default:
							Location loc = null;
							Reflection ref = activeChar.getReflection();

							if(ref == ReflectionManager.DEFAULT)
									for(GlobalEvent e : activeChar.getEvents())
											loc = e.getRestartLoc(activeChar, _restartType);

							if(loc == null)
									loc = defaultLoc(_restartType, activeChar);

							if(loc != null)
							{
									Pair<Integer, OnAnswerListener> ask = activeChar.getAskListener(false);
									if(ask != null && ask.getValue() instanceof ReviveAnswerListener && !((ReviveAnswerListener) ask.getValue()).isForPet())
											activeChar.getAskListener(true);

									activeChar.setPendingRevive(true);
									activeChar.teleToLocation(loc, ReflectionManager.DEFAULT);
							}
							else
									activeChar.sendPacket(ActionFail.STATIC, new Die(activeChar));
							break;
			}
	}

	//FIXME [VISTALL] вынести куда то?
	// телепорт к флагу, не обрабатывается, по дефалту
	public static Location defaultLoc(RestartType restartType, Player activeChar)
	{
			Location loc = null;
			Clan clan = activeChar.getClan();

			switch(restartType)
			{
					case TO_CLANHALL:
							if(clan != null && clan.getHasHideout() != 0)
							{
									ClanHall clanHall = activeChar.getClanHall();
									loc = TeleportUtils.getRestartLocation(activeChar, RestartType.TO_CLANHALL);
									if(clanHall.getFunction(ResidenceFunction.RESTORE_EXP) != null)
											activeChar.restoreExp(clanHall.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
							}
							break;
					case TO_CASTLE:
							if(clan != null && clan.getCastle() != 0)
							{
									Castle castle = activeChar.getCastle();
									loc = TeleportUtils.getRestartLocation(activeChar, RestartType.TO_CASTLE);
									if(castle.getFunction(ResidenceFunction.RESTORE_EXP) != null)
											activeChar.restoreExp(castle.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
							}
							break;
					case TO_FORTRESS:
							if(clan != null && clan.getHasFortress() != 0)
							{
									Fortress fort = activeChar.getFortress();
									loc = TeleportUtils.getRestartLocation(activeChar, RestartType.TO_FORTRESS);
									if(fort.getFunction(ResidenceFunction.RESTORE_EXP) != null)
											activeChar.restoreExp(fort.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
							}
							break;
					case TO_VILLAGE:
					default:
							loc = TeleportUtils.getRestartLocation(activeChar, RestartType.TO_VILLAGE);
							break;
			}
			return loc;
	}
}

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


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

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...