Sync with L2jServer HighFive Oct 10th 2015.
This commit is contained in:
@@ -18,9 +18,7 @@
|
||||
*/
|
||||
package handlers.admincommandhandlers;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -123,16 +121,18 @@ public class AdminEventEngine implements IAdminCommandHandler
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
|
||||
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(Config.DATAPACK_ROOT + "events/" + eventName)));
|
||||
BufferedReader inbr = new BufferedReader(new InputStreamReader(in));
|
||||
adminReply.setFile("en", "html/mods/EventEngine/Participation.htm");
|
||||
adminReply.replace("%eventName%", eventName);
|
||||
adminReply.replace("%eventCreator%", inbr.readLine());
|
||||
adminReply.replace("%eventInfo%", inbr.readLine());
|
||||
adminReply.replace("npc_%objectId%_event_participate", "admin_event"); // Weird, but nice hack, isnt it? :)
|
||||
adminReply.replace("button value=\"Participate\"", "button value=\"Back\"");
|
||||
activeChar.sendPacket(adminReply);
|
||||
inbr.close();
|
||||
try (FileInputStream fis = new FileInputStream(Config.DATAPACK_ROOT + "events/" + eventName);
|
||||
InputStreamReader isr = new InputStreamReader(fis);
|
||||
BufferedReader br = new BufferedReader(isr))
|
||||
{
|
||||
adminReply.setFile("en", "html/mods/EventEngine/Participation.htm");
|
||||
adminReply.replace("%eventName%", eventName);
|
||||
adminReply.replace("%eventCreator%", br.readLine());
|
||||
adminReply.replace("%eventInfo%", br.readLine());
|
||||
adminReply.replace("npc_%objectId%_event_participate", "admin_event"); // Weird, but nice hack, isnt it? :)
|
||||
adminReply.replace("button value=\"Participate\"", "button value=\"Back\"");
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -165,12 +165,12 @@ public class AdminEventEngine implements IAdminCommandHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
FileOutputStream file = new FileOutputStream(new File(Config.DATAPACK_ROOT, "events/" + tempName));
|
||||
PrintStream p = new PrintStream(file);
|
||||
p.println(activeChar.getName());
|
||||
p.println(tempBuffer);
|
||||
file.close();
|
||||
p.close();
|
||||
try (FileOutputStream file = new FileOutputStream(new File(Config.DATAPACK_ROOT, "events/" + tempName));
|
||||
PrintStream p = new PrintStream(file))
|
||||
{
|
||||
p.println(activeChar.getName());
|
||||
p.println(tempBuffer);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -476,7 +476,7 @@ public class AdminEventEngine implements IAdminCommandHandler
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
|
||||
final String replyMSG = StringUtil.concat("<html><title>[ L2J EVENT ENGINE ]</title><body>" + "<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=150 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<center><br><font color=LEVEL>Stored Events:</font><br></center>", showStoredEvents(), "</body></html>");
|
||||
final String replyMSG = StringUtil.concat("<html><title>[ EVENT ENGINE ]</title><body>" + "<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=150 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<center><br><font color=LEVEL>Stored Events:</font><br></center>", showStoredEvents(), "</body></html>");
|
||||
adminReply.setHtml(replyMSG);
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.entity.Instance;
|
||||
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jserver.gameserver.model.holders.SummonRequestHolder;
|
||||
import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@@ -124,7 +125,7 @@ public final class CallPc extends AbstractEffect
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.isInOlympiadMode())
|
||||
if (target.isInOlympiadMode() || OlympiadManager.getInstance().isRegisteredInComp(target))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
|
||||
return false;
|
||||
|
@@ -21,6 +21,8 @@ package handlers.effecthandlers;
|
||||
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.TeleportWhereType;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2GuardInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
@@ -61,7 +63,15 @@ public final class Escape extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
info.getEffected().teleToLocation(MapRegionManager.getInstance().getTeleToLocation(info.getEffected(), _escapeType), true);
|
||||
info.getEffected().setInstanceId(0);
|
||||
if (info.getEffected() instanceof L2GuardInstance)
|
||||
{
|
||||
info.getEffected().teleToLocation(((L2Npc) info.getEffected()).getSpawn());
|
||||
info.getEffected().setHeading(((L2Npc) info.getEffected()).getSpawn().getHeading());
|
||||
}
|
||||
else
|
||||
{
|
||||
info.getEffected().teleToLocation(MapRegionManager.getInstance().getTeleToLocation(info.getEffected(), _escapeType), true);
|
||||
info.getEffected().setInstanceId(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
@@ -64,29 +64,15 @@ public final class RandomizeHate extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
L2Attackable effectedMob = (L2Attackable) info.getEffected();
|
||||
final List<L2Character> targetList = new ArrayList<>();
|
||||
for (L2Character cha : info.getEffected().getKnownList().getKnownCharacters())
|
||||
{
|
||||
if ((cha != null) && (cha != effectedMob) && (cha != info.getEffector()))
|
||||
{
|
||||
// Aggro cannot be transfered to a mob of the same faction.
|
||||
if (cha.isAttackable() && ((L2Attackable) cha).isInMyClan(effectedMob))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
targetList.add(cha);
|
||||
}
|
||||
}
|
||||
// if there is no target, exit function
|
||||
if (targetList.isEmpty())
|
||||
final L2Attackable effectedMob = (L2Attackable) info.getEffected();
|
||||
final List<L2Character> aggroList = effectedMob.getAggroList().keySet().stream().filter(c -> c != info.getEffector()).collect(Collectors.toList());
|
||||
if (aggroList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Choosing randomly a new target
|
||||
final L2Character target = targetList.get(Rnd.get(targetList.size()));
|
||||
final L2Character target = aggroList.get(Rnd.get(aggroList.size()));
|
||||
final int hate = effectedMob.getHating(info.getEffector());
|
||||
effectedMob.stopHating(info.getEffector());
|
||||
effectedMob.addDamageHate(target, 0, hate);
|
||||
|
@@ -18,45 +18,47 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
|
||||
/**
|
||||
* Servitor Share effect implementation.<br>
|
||||
* Synchronizing effects on player and servitor if one of them gets removed for some reason the same will happen to another. Partner's effect exit is executed in own thread, since there is no more queue to schedule the effects,<br>
|
||||
* partner's effect is called while this effect is still exiting issuing an exit call for the effect, causing a stack over flow.
|
||||
* @author UnAfraid, Zoey76
|
||||
* Servitor Share effect implementation. Have effect only on servitor's but not on pets Important: Only one effect can be used on char per time.
|
||||
* @author Zealar
|
||||
*/
|
||||
public final class ServitorShare extends AbstractEffect
|
||||
{
|
||||
private static final class ScheduledEffectExitTask implements Runnable
|
||||
{
|
||||
private final L2Character _effected;
|
||||
private final int _skillId;
|
||||
|
||||
public ScheduledEffectExitTask(L2Character effected, int skillId)
|
||||
{
|
||||
_effected = effected;
|
||||
_skillId = skillId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_effected.stopSkillEffects(false, _skillId);
|
||||
}
|
||||
}
|
||||
private final Map<Stats, Double> stats = new HashMap<>(9);
|
||||
|
||||
public ServitorShare(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
for (String key : params.getSet().keySet())
|
||||
{
|
||||
stats.put(Stats.valueOfXml(key), params.getDouble(key, 1.));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
super.onStart(info);
|
||||
info.getEffected().getActingPlayer().setServitorShare(stats);
|
||||
if (info.getEffected().getActingPlayer().getServitors() != null)
|
||||
{
|
||||
for (L2Summon summon : info.getEffected().getActingPlayer().getServitors().values())
|
||||
{
|
||||
summon.broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,11 +76,13 @@ public final class ServitorShare extends AbstractEffect
|
||||
@Override
|
||||
public void onExit(BuffInfo info)
|
||||
{
|
||||
final L2Character effected = info.getEffected().isSummon() ? ((L2Summon) info.getEffected()).getOwner() : info.getEffected();
|
||||
|
||||
if (effected != null)
|
||||
info.getEffected().getActingPlayer().setServitorShare(null);
|
||||
if (info.getEffected().getServitors() != null)
|
||||
{
|
||||
ThreadPoolManager.getInstance().scheduleEffect(new ScheduledEffectExitTask(effected, info.getSkill().getId()), 100);
|
||||
for (L2Summon summon : info.getEffected().getActingPlayer().getServitors().values())
|
||||
{
|
||||
summon.broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user