Aion Gates
Would you like to react to this message? Create an account in a few clicks or log in to continue.

MAU transformation Fix need to test

Go down

MAU transformation Fix need to test  Empty MAU transformation Fix need to test

Post  M@xx Mon 23 Aug - 17:24

Index: src/com/aionemu/gameserver/skillengine/effect/TransformEffect.java
Code:
/*
 * This file is part of aion-unique <aion-Gates>.
 *
 */
package com.aionemu.gameserver.skillengine.effect;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;

import com.aionemu.gameserver.model.gameobjects.Creature;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.network.aion.serverpackets.SM_TRANSFORM;
import com.aionemu.gameserver.skillengine.model.Effect;
import com.aionemu.gameserver.utils.PacketSendUtility;

/**
 * @author M@xx
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TransformEffect")
public class TransformEffect extends EffectTemplate
{
   @XmlAttribute
   protected int model;
   
   @Override
   public void applyEffect(Effect effect)
   {
      final Creature effected = effect.getEffected();
      boolean transformed = false;
      if(effected instanceof Npc)
      {
         transformed = effected.getTransformedModelId() == effected.getObjectTemplate().getTemplateId();
      }
      else if(effected instanceof Player)
      {
         transformed = effected.getTransformedModelId() != 0;
      }
      if (transformed)
      {
         for ( Effect tmp : effected.getEffectController().getAbnormalEffects())
         {
            if (effect.getSkillId() == tmp.getSkillId())
               continue;
            boolean abort = false;
            for (EffectTemplate template : tmp.getEffectTemplates())
            {
               if (template instanceof TransformEffect)
               {
                  abort = true;
                  break;
               }
            }
            if (abort)
               tmp.endEffect();
         }
      }
      effect.addToEffectedController();
   }

   @Override
   public void calculate(Effect effect)
   {
      //TODO calc probability
      effect.addSucessEffect(this);
   }

   @Override
   public void endEffect(Effect effect)
   {
      final Creature effected = effect.getEffected();
      effected.getEffectController().unsetAbnormal(EffectId.SHAPECHANGE.getEffectId());

      if(effected instanceof Npc)
      {
         effected.setTransformedModelId(effected.getObjectTemplate().getTemplateId());
      }
      else if(effected instanceof Player)
      {
         effected.setTransformedModelId(0);
      }
      PacketSendUtility.broadcastPacketAndReceive(effected, new SM_TRANSFORM(effected));
   }

   @Override
   public void startEffect(final Effect effect)
   {
      final Creature effected = effect.getEffected();
      for (int e = 780;e=<791;e++)   //check, if transform - don't ban flying
      {
         if (effect.getSkillId()!=e)
            effected.getEffectController().setAbnormal(EffectId.SHAPECHANGE.getEffectId());
      }
      effected.setTransformedModelId(model);
      PacketSendUtility.broadcastPacketAndReceive(effected, new SM_TRANSFORM(effected));
   }
}
M@xx
M@xx
Core dev
Core dev

Messages : 83
Date d'inscription : 2010-07-30

https://aiongates.forums-actifs.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum