protected void startCast(){
  int targetObjId=firstTarget != null ? firstTarget.getObjectId() : 0;
  if (skillMethod == SkillMethod.CAST || skillMethod == SkillMethod.CHARGE) {
switch (targetType) {
case 0:
      PacketSendUtility.broadcastPacketAndReceive(effector,new SM_CASTSPELL(effector.getObjectId(),skillTemplate.getSkillId(),skillLevel,targetType,targetObjId,this.duration,skillTemplate.isCharge()));
    if (firstTarget.getObjectId() != effector.getObjectId()) {
      PacketSendUtility.broadcastPacketAndReceive(effector,new SM_ATTACK_STATUS(effector,SM_ATTACK_STATUS.TYPE.ATTACK,0,0,SM_ATTACK_STATUS.LOG.ATTACK));
    }
  if (effector instanceof Npc && firstTarget instanceof Player) {
    NpcAI2 ai=(NpcAI2)effector.getAi2();
    if (ai.poll(AIQuestion.CAN_SHOUT)) {
      ShoutEventHandler.onCast(ai,firstTarget);
    }
  }
break;
case 3:
PacketSendUtility.broadcastPacketAndReceive(effector,new SM_CASTSPELL(effector.getObjectId(),skillTemplate.getSkillId(),skillLevel,targetType,0,this.duration,skillTemplate.isCharge()));
if (firstTarget.getObjectId() != effector.getObjectId()) {
PacketSendUtility.broadcastPacketAndReceive(effector,new SM_ATTACK_STATUS(effector,SM_ATTACK_STATUS.TYPE.ATTACK,0,0,SM_ATTACK_STATUS.LOG.ATTACK));
}
break;
case 1:
PacketSendUtility.broadcastPacketAndReceive(effector,new SM_CASTSPELL(effector.getObjectId(),skillTemplate.getSkillId(),skillLevel,targetType,x,y,z,this.duration));
if (firstTarget.getObjectId() != effector.getObjectId()) {
PacketSendUtility.broadcastPacketAndReceive(effector,new SM_ATTACK_STATUS(effector,SM_ATTACK_STATUS.TYPE.ATTACK,0,0,SM_ATTACK_STATUS.LOG.ATTACK));
}
break;
}
}
 else if (skillMethod == SkillMethod.ITEM && duration > 0) {
PacketSendUtility.broadcastPacketAndReceive(effector,new SM_ITEM_USAGE_ANIMATION(effector.getObjectId(),firstTarget.getObjectId(),(this.itemObjectId == 0 ? 0 : this.itemObjectId),itemTemplate.getTemplateId(),this.duration,0,0));
}
}

protected void startCast ( ) { int targetObjId = firstTarget != null ? firstTarget . getObjectId ( ) : 0 ; if ( skillMethod == SkillMethod . CAST || skillMethod == SkillMethod . CHARGE ) { switch ( targetType ) { case 0 : PacketSendUtility . broadcastPacketAndReceive ( effector , new SM_CASTSPELL ( effector . getObjectId ( ) , skillTemplate . getSkillId ( ) , skillLevel , targetType , targetObjId , this . duration , skillTemplate . isCharge ( ) ) ) ; if ( firstTarget . getObjectId ( ) != effector . getObjectId ( ) ) { PacketSendUtility . broadcastPacketAndReceive ( effector , new SM_ATTACK_STATUS ( effector , SM_ATTACK_STATUS . TYPE . ATTACK , 0 , 0 , SM_ATTACK_STATUS . LOG . ATTACK ) ) ; } if ( effector instanceof Npc && firstTarget instanceof Player ) { NpcAI2 ai = ( NpcAI2 ) effector . getAi2 ( ) ; if ( ai . poll ( AIQuestion . CAN_SHOUT ) ) { ShoutEventHandler . onCast ( ai , firstTarget ) ; } } break ; case 3 : PacketSendUtility . broadcastPacketAndReceive ( effector , new SM_CASTSPELL ( effector . getObjectId ( ) , skillTemplate . getSkillId ( ) , skillLevel , targetType , 0 , this . duration , skillTemplate . isCharge ( ) ) ) ; if ( firstTarget . getObjectId ( ) != effector . getObjectId ( ) ) { PacketSendUtility . broadcastPacketAndReceive ( effector , new SM_ATTACK_STATUS ( effector , SM_ATTACK_STATUS . TYPE . ATTACK , 0 , 0 , SM_ATTACK_STATUS . LOG . ATTACK ) ) ; } break ; case 1 : PacketSendUtility . broadcastPacketAndReceive ( effector , new SM_CASTSPELL ( effector . getObjectId ( ) , skillTemplate . getSkillId ( ) , skillLevel , targetType , x , y , z , this . duration ) ) ; if ( firstTarget . getObjectId ( ) != effector . getObjectId ( ) ) { PacketSendUtility . broadcastPacketAndReceive ( effector , new SM_ATTACK_STATUS ( effector , SM_ATTACK_STATUS . TYPE . ATTACK , 0 , 0 , SM_ATTACK_STATUS . LOG . ATTACK ) ) ; } break ; } } else if ( skillMethod == SkillMethod . ITEM && duration > 0 ) { PacketSendUtility . broadcastPacketAndReceive ( effector , new SM_ITEM_USAGE_ANIMATION ( effector . getObjectId ( ) , firstTarget . getObjectId ( ) , ( this . itemObjectId == 0 ? 0 : this . itemObjectId ) , itemTemplate . getTemplateId ( ) , this . duration , 0 , 0 ) ) ; } }
start casting of skill
