Browse Source

Event effects rework.

Gigiikun 15 years ago
parent
commit
382a38ef76

+ 9 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/L2Effect.java

@@ -23,6 +23,7 @@ import java.util.logging.Logger;
 import com.l2jserver.gameserver.GameTimeController;
 import com.l2jserver.gameserver.GameTimeController;
 import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.datatables.SkillTable;
+import com.l2jserver.gameserver.model.L2Object.InstanceType;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2SummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2SummonInstance;
@@ -101,6 +102,8 @@ public abstract class L2Effect
 	private AbnormalEffect _abnormalEffect;
 	private AbnormalEffect _abnormalEffect;
 	// special effect mask
 	// special effect mask
 	private AbnormalEffect _specialEffect;
 	private AbnormalEffect _specialEffect;
+	// event effect mask
+	private AbnormalEffect _eventEffect;
 	// show icon
 	// show icon
 	private boolean _icon;
 	private boolean _icon;
 	
 	
@@ -187,6 +190,7 @@ public abstract class L2Effect
 		_period = temp;
 		_period = temp;
 		_abnormalEffect = template.abnormalEffect;
 		_abnormalEffect = template.abnormalEffect;
 		_specialEffect = template.specialEffect;
 		_specialEffect = template.specialEffect;
+		_eventEffect = template.eventEffect;
 		_stackType = template.stackType;
 		_stackType = template.stackType;
 		_stackOrder = template.stackOrder;
 		_stackOrder = template.stackOrder;
 		_periodStartTicks = GameTimeController.getGameTicks();
 		_periodStartTicks = GameTimeController.getGameTicks();
@@ -226,6 +230,7 @@ public abstract class L2Effect
 		_period = _template.period - effect.getTime();
 		_period = _template.period - effect.getTime();
 		_abnormalEffect = _template.abnormalEffect;
 		_abnormalEffect = _template.abnormalEffect;
 		_specialEffect = _template.specialEffect;
 		_specialEffect = _template.specialEffect;
+		_eventEffect = _template.eventEffect;
 		_stackType = _template.stackType;
 		_stackType = _template.stackType;
 		_stackOrder = _template.stackOrder;
 		_stackOrder = _template.stackOrder;
 		_periodStartTicks = effect.getPeriodStartTicks();
 		_periodStartTicks = effect.getPeriodStartTicks();
@@ -447,6 +452,8 @@ public abstract class L2Effect
 			getEffected().startAbnormalEffect(_abnormalEffect);
 			getEffected().startAbnormalEffect(_abnormalEffect);
 		if (_specialEffect != AbnormalEffect.NULL)
 		if (_specialEffect != AbnormalEffect.NULL)
 			getEffected().startSpecialEffect(_specialEffect);
 			getEffected().startSpecialEffect(_specialEffect);
+		if (_eventEffect != AbnormalEffect.NULL && getEffected().getInstanceType() == InstanceType.L2PcInstance)
+			getEffected().getActingPlayer().startEventEffect(_eventEffect);
 		return true;
 		return true;
 	}
 	}
 	
 	
@@ -459,6 +466,8 @@ public abstract class L2Effect
 			getEffected().stopAbnormalEffect(_abnormalEffect);
 			getEffected().stopAbnormalEffect(_abnormalEffect);
 		if (_specialEffect != AbnormalEffect.NULL)
 		if (_specialEffect != AbnormalEffect.NULL)
 			getEffected().stopSpecialEffect(_specialEffect);
 			getEffected().stopSpecialEffect(_specialEffect);
+		if (_eventEffect != AbnormalEffect.NULL && getEffected().getInstanceType() == InstanceType.L2PcInstance)
+			getEffected().getActingPlayer().stopEventEffect(_eventEffect);
 	}
 	}
 	
 	
 	/** Return true for continuation of this effect */
 	/** Return true for continuation of this effect */

+ 0 - 10
L2_GameServer/java/com/l2jserver/gameserver/model/L2Skill.java

@@ -265,7 +265,6 @@ public abstract class L2Skill implements IChanceSkillTrigger
     private final boolean _isDebuff;
     private final boolean _isDebuff;
     
     
 	private final String _attribute;
 	private final String _attribute;
-	private final int _afroId;
 
 
 	private final boolean _ignoreShield;
 	private final boolean _ignoreShield;
 	private final boolean _isSuicideAttack;
 	private final boolean _isSuicideAttack;
@@ -280,7 +279,6 @@ public abstract class L2Skill implements IChanceSkillTrigger
         _id = set.getInteger("skill_id");
         _id = set.getInteger("skill_id");
         _level = set.getInteger("level");
         _level = set.getInteger("level");
         _refId = set.getInteger("referenceId", set.getInteger("itemConsumeId", 0));
         _refId = set.getInteger("referenceId", set.getInteger("itemConsumeId", 0));
-        _afroId = set.getInteger("afroId",0);
         _displayId = set.getInteger("displayId", _id);
         _displayId = set.getInteger("displayId", _id);
         _name = set.getString("name");
         _name = set.getString("name");
         _operateType = set.getEnum("operateType", SkillOpType.class);
         _operateType = set.getEnum("operateType", SkillOpType.class);
@@ -2528,14 +2526,6 @@ public abstract class L2Skill implements IChanceSkillTrigger
 	    return _refId;
 	    return _refId;
     }
     }
 
 
-	/**
-     * @return
-     */
-    public int getAfroColor()
-    {
-	    return _afroId;
-    }
-
     public final int getMaxCharges()
     public final int getMaxCharges()
     {
     {
     	return _maxCharges;
     	return _maxCharges;

+ 20 - 13
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -226,6 +226,7 @@ import com.l2jserver.gameserver.network.serverpackets.TradeDone;
 import com.l2jserver.gameserver.network.serverpackets.TradeOtherDone;
 import com.l2jserver.gameserver.network.serverpackets.TradeOtherDone;
 import com.l2jserver.gameserver.network.serverpackets.TradeStart;
 import com.l2jserver.gameserver.network.serverpackets.TradeStart;
 import com.l2jserver.gameserver.network.serverpackets.UserInfo;
 import com.l2jserver.gameserver.network.serverpackets.UserInfo;
+import com.l2jserver.gameserver.skills.AbnormalEffect;
 import com.l2jserver.gameserver.skills.Formulas;
 import com.l2jserver.gameserver.skills.Formulas;
 import com.l2jserver.gameserver.skills.Stats;
 import com.l2jserver.gameserver.skills.Stats;
 import com.l2jserver.gameserver.skills.l2skills.L2SkillSiegeFlag;
 import com.l2jserver.gameserver.skills.l2skills.L2SkillSiegeFlag;
@@ -13050,7 +13051,7 @@ public final class L2PcInstance extends L2Playable
 
 
 	private FastMap<Integer, TimeStamp> _reuseTimeStamps = new FastMap<Integer, TimeStamp>().shared();
 	private FastMap<Integer, TimeStamp> _reuseTimeStamps = new FastMap<Integer, TimeStamp>().shared();
 	private boolean _canFeed;
 	private boolean _canFeed;
-	private int _afroId = 0;
+	private int _eventEffectId = 0;
 	private boolean _isInSiege;
 	private boolean _isInSiege;
 
 
     public Collection<TimeStamp> getReuseTimeStamps()
     public Collection<TimeStamp> getReuseTimeStamps()
@@ -13747,18 +13748,24 @@ public final class L2PcInstance extends L2Playable
     }
     }
 
 
 	/**
 	/**
-     * @return afro haircut id
-     */
-    public int getAfroHaircutId()
-    {
-	    return _afroId ;
-    }
-    
-    public void setAfroHaircutId(int id)
-    {
-	    _afroId = id;
-	    broadcastUserInfo();
-    }
+	 * @return event effect id
+	 */
+	public int getEventEffectId()
+	{
+		return _eventEffectId ;
+	}
+
+	public void startEventEffect(AbnormalEffect mask)
+	{
+		_eventEffectId |= mask.getMask();
+		broadcastUserInfo();
+	}
+
+	public void stopEventEffect(AbnormalEffect mask)
+	{
+		_eventEffectId &= ~mask.getMask();
+		broadcastUserInfo();
+	}
 
 
     public void setIsInSiege(boolean b)
     public void setIsInSiege(boolean b)
     {
     {

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExBrExtraUserInfo.java

@@ -28,7 +28,7 @@ public class ExBrExtraUserInfo extends L2GameServerPacket
 	public ExBrExtraUserInfo(L2PcInstance player)
 	public ExBrExtraUserInfo(L2PcInstance player)
 	{
 	{
 		_charObjId = player.getObjectId();
 		_charObjId = player.getObjectId();
-		_val = player.getAfroHaircutId();
+		_val = player.getEventEffectId();
 		_invisible = player.getAppearance().getInvisible();
 		_invisible = player.getAppearance().getInvisible();
 	}
 	}
 
 
@@ -42,7 +42,7 @@ public class ExBrExtraUserInfo extends L2GameServerPacket
 		writeC(0xfe);
 		writeC(0xfe);
 		writeH(0xbe);
 		writeH(0xbe);
 		writeD(_charObjId); //object ID of Player
 		writeD(_charObjId); //object ID of Player
-		writeD(_val);		// Afro Hair Cut
+		writeD(_val);		// event effect id
 		//writeC(0x00);		// Event flag, added only if event is active
 		//writeC(0x00);		// Event flag, added only if event is active
 
 
 	}
 	}

+ 11 - 1
L2_GameServer/java/com/l2jserver/gameserver/skills/AbnormalEffect.java

@@ -66,7 +66,17 @@ public enum AbnormalEffect
 	S_PINK_AFFRO("pinkafro", 0x000020),
 	S_PINK_AFFRO("pinkafro", 0x000020),
 	S_BLACK_AFFRO("blackafro", 0x000040),
 	S_BLACK_AFFRO("blackafro", 0x000040),
 	S_UNKNOWN8("unknown8", 0x000080),
 	S_UNKNOWN8("unknown8", 0x000080),
-	STIGMA_SHILIEN("stigmashilien", 0x000100);
+	STIGMA_SHILIEN("stigmashilien", 0x000100),
+	
+	// event effects
+	E_AFRO_1("blackafro", 0x000001),
+	E_AFRO_2("pinkafro", 0x000002),
+	E_AFRO_3("yellowafro", 0x000004),
+	E_EVASWRATH("evaswrath", 0x000008),
+	E_HEADPHONE("headphone", 0x000010),
+	E_VESPER_1("vesper1", 0x000020),
+	E_VESPER_2("vesper2", 0x000040),
+	E_VESPER_3("vesper3", 0x000080);
 	
 	
 	private final int _mask;
 	private final int _mask;
 	private final String _name;
 	private final String _name;

+ 7 - 1
L2_GameServer/java/com/l2jserver/gameserver/skills/DocumentBase.java

@@ -243,6 +243,12 @@ abstract class DocumentBase
             String spc = attrs.getNamedItem("special").getNodeValue();
             String spc = attrs.getNamedItem("special").getNodeValue();
             special = AbnormalEffect.getByName(spc);
             special = AbnormalEffect.getByName(spc);
         }
         }
+        AbnormalEffect event = AbnormalEffect.NULL;
+        if (attrs.getNamedItem("event") != null)
+        {
+            String spc = attrs.getNamedItem("event").getNodeValue();
+            special = AbnormalEffect.getByName(spc);
+        }
         float stackOrder = 0;
         float stackOrder = 0;
         String stackType = "none";
         String stackType = "none";
         if (attrs.getNamedItem("stackType") != null)
         if (attrs.getNamedItem("stackType") != null)
@@ -311,7 +317,7 @@ abstract class DocumentBase
 			throw new NoSuchElementException("Invalid chance condition: " + chanceCond + " "
 			throw new NoSuchElementException("Invalid chance condition: " + chanceCond + " "
 			        + activationChance);        	
 			        + activationChance);        	
         	
         	
-        lt = new EffectTemplate(attachCond, applayCond, name, lambda, count, time, abnormal, special, stackType, stackOrder, icon, effectPower, type, trigId, trigLvl, chance);
+        lt = new EffectTemplate(attachCond, applayCond, name, lambda, count, time, abnormal, special, event, stackType, stackOrder, icon, effectPower, type, trigId, trigLvl, chance);
 		parseTemplate(n, lt);
 		parseTemplate(n, lt);
 		if (template instanceof L2Item)
 		if (template instanceof L2Item)
 			((L2Item) template).attach(lt);
 			((L2Item) template).attach(lt);

+ 0 - 77
L2_GameServer/java/com/l2jserver/gameserver/skills/effects/EffectAfroHaircut.java

@@ -1,77 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.gameserver.skills.effects;
-
-import com.l2jserver.gameserver.model.L2Effect;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.skills.Env;
-import com.l2jserver.gameserver.templates.effects.EffectTemplate;
-import com.l2jserver.gameserver.templates.skills.L2EffectType;
-
-/**
- * 
- * @author Kerberos
- */
-public class EffectAfroHaircut extends L2Effect
-{
-	public EffectAfroHaircut(Env env, EffectTemplate template)
-	{
-		super(env, template);
-	}
-	
-	/**
-	 * @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
-	 */
-	@Override
-	public L2EffectType getEffectType()
-	{
-		return L2EffectType.AFROHAIR;
-	}
-	
-	/**
-	 * 
-	 * @see com.l2jserver.gameserver.model.L2Effect#onStart()
-	 */
-	@Override
-	public boolean onStart()
-	{
-		if (getEffected() instanceof L2PcInstance)
-		{
-			((L2PcInstance) getEffected()).setAfroHaircutId(getSkill().getAfroColor());
-			return true;
-		}
-		return false;
-	}
-	
-	/**
-	 * 
-	 * @see com.l2jserver.gameserver.model.L2Effect#onExit()
-	 */
-	@Override
-	public void onExit()
-	{
-		((L2PcInstance) getEffected()).setAfroHaircutId(0);
-	}
-	
-	/**
-	 * @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
-	 */
-	@Override
-	public boolean onActionTime()
-	{
-		return false;
-	}
-	
-}

+ 4 - 1
L2_GameServer/java/com/l2jserver/gameserver/templates/effects/EffectTemplate.java

@@ -46,6 +46,7 @@ public class EffectTemplate
 	public final int period; // in seconds
 	public final int period; // in seconds
 	public final AbnormalEffect abnormalEffect;
 	public final AbnormalEffect abnormalEffect;
 	public final AbnormalEffect specialEffect;
 	public final AbnormalEffect specialEffect;
+	public final AbnormalEffect eventEffect;
 	public FuncTemplate[] funcTemplates;
 	public FuncTemplate[] funcTemplates;
 	public final String stackType;
 	public final String stackType;
 	public final float stackOrder;
 	public final float stackOrder;
@@ -59,7 +60,8 @@ public class EffectTemplate
     public final ChanceCondition chanceCondition;
     public final ChanceCondition chanceCondition;
 	
 	
 	public EffectTemplate(Condition pAttachCond, Condition pApplayCond, String func, Lambda pLambda, 
 	public EffectTemplate(Condition pAttachCond, Condition pApplayCond, String func, Lambda pLambda, 
-			int pCounter, int pPeriod, AbnormalEffect pAbnormalEffect, AbnormalEffect pSpecialEffect, String pStackType, float pStackOrder, boolean showicon,
+			int pCounter, int pPeriod, AbnormalEffect pAbnormalEffect, AbnormalEffect pSpecialEffect, 
+			AbnormalEffect pEventEffect, String pStackType, float pStackOrder, boolean showicon, 
 			double ePower, L2SkillType eType, int trigId, int trigLvl, ChanceCondition chanceCond)
 			double ePower, L2SkillType eType, int trigId, int trigLvl, ChanceCondition chanceCond)
 	{
 	{
 		attachCond = pAttachCond;
 		attachCond = pAttachCond;
@@ -69,6 +71,7 @@ public class EffectTemplate
 		period = pPeriod;
 		period = pPeriod;
 		abnormalEffect = pAbnormalEffect;
 		abnormalEffect = pAbnormalEffect;
 		specialEffect = pSpecialEffect;
 		specialEffect = pSpecialEffect;
+		eventEffect = pEventEffect;
 		stackType = pStackType;
 		stackType = pStackType;
 		stackOrder = pStackOrder;
 		stackOrder = pStackOrder;
 		icon = showicon;
 		icon = showicon;

+ 0 - 1
L2_GameServer/java/com/l2jserver/gameserver/templates/skills/L2EffectType.java

@@ -64,7 +64,6 @@ public enum L2EffectType
 	WARP,
 	WARP,
 	SPOIL,
 	SPOIL,
 	PROTECTION_BLESSING,
 	PROTECTION_BLESSING,
-	AFROHAIR,
 	FUSION,
 	FUSION,
 	CHANCE_SKILL_TRIGGER,
 	CHANCE_SKILL_TRIGGER,
 	CLAN_GATE,
 	CLAN_GATE,