• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

L2J Gift of vitality problem

Status
Not open for further replies.
Newbie Spellweaver
Joined
Apr 2, 2013
Messages
5
Reaction score
0
Hi guys i use l2 emu h5
and in this pack there is no event gift of vitality..
so i find some releazes from the event and all give me back errors on gameserver..
the last one i modified a little it gives no errors but inside the game the gift o vitality doesn't
work..it seems that it buffs u but no vitality buff given...all the other options from the npc works good..

Here is the code :


Code:
/*
 * 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/>.
 */
/*
 * 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 events.GiftOfVitality;


import net.l2emuproject.gameserver.datatables.SkillTable;
import net.l2emuproject.gameserver.instancemanager.QuestManager;
import net.l2emuproject.gameserver.model.actor.L2Npc;
import net.l2emuproject.gameserver.model.actor.instance.L2PcInstance;
import net.l2emuproject.gameserver.model.actor.instance.L2SummonInstance;
import net.l2emuproject.gameserver.model.quest.Quest;
import net.l2emuproject.gameserver.model.quest.QuestState;
import net.l2emuproject.gameserver.model.quest.State;
import net.l2emuproject.gameserver.network.SystemMessageId;
import net.l2emuproject.gameserver.network.serverpackets.SystemMessage;


/**
 ** @author Gnacik
 **
 ** Retail Event : 'Gift of Vitality'
 */
public class GiftOfVitality extends Quest
{
   // Reuse between buffs
   private static final int _hours = 5;
   
   private static final int _jack = 4306;
   
   private static final int[][] _spawns =
   {
      {  82766,  149438, -3464, 33865 },
      {  82286,   53291, -1488, 15250 },
      { 147060,   25943, -2008, 18774 },
      { 148096,  -55466, -2728, 40541 },
      {  87116, -141332, -1336, 52193 },
      {  43521,  -47542,  -792, 31655 },
      {  17203,  144949, -3024, 18166 },
      { 111164,  221062, -3544,  2714 },
      { -13869,  122063, -2984, 18270 },
      { -83161,  150915, -3120, 17311 },
      {  45402,   48355, -3056, 49153 },
      { 115616, -177941,  -896, 30708 },
      { -44928, -113608,  -192, 30212 },
      { -84037,  243194, -3728,  8992 },
      {-119690,   44583,   360, 29289 },
      {  12084,   16576, -4584, 57345 }
   };
   
   public GiftOfVitality(int questId, String name, String descr)
   {
      super(questId, name, descr);
      addStartNpc(_jack);
      addFirstTalkId(_jack);
      addTalkId(_jack);
      for(int[] _spawn : _spawns)
         addSpawn(_jack, _spawn[0], _spawn[1], _spawn[2], _spawn[3], false, 0);
   }
   
   @Override
   public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
   {
      String htmltext = "";
      QuestState st = player.getQuestState(getName());
      htmltext = event;
      
      if (event.equalsIgnoreCase("vitality"))
      {
         long _reuse = 0;
         String _streuse = (String) st.get("reuse");
         if(_streuse != null)
            _reuse = Long.parseLong(_streuse);
         if(_reuse > System.currentTimeMillis())
         {
            long remainingTime = (_reuse - System.currentTimeMillis()) / 1000;
            int hours = (int) (remainingTime / 3600);
            int minutes = (int) ((remainingTime%3600) / 60);
            SystemMessage sm = new SystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES);
            sm.addSkillName(23179);
            sm.addNumber(hours);
            sm.addNumber(minutes);
            player.sendPacket(sm);
            htmltext = "4306-notime.htm";
         }
         else
         {
            npc.setTarget(player);
            npc.doCast(SkillTable.getInstance().getInfo(23179,1));   // Gift of Vitality
            st.setState(State.STARTED);
            st.set("reuse", String.valueOf(System.currentTimeMillis() + _hours*60*60*1000));
            htmltext = "4306-okvitality.htm";
         }
      }
      else if (event.equalsIgnoreCase("memories_player"))
      {
         if (player.getLevel() < 76)
         {
            htmltext = "4306-nolevel.htm";
         }
         else
         {
            if (player.isMageClass())
            {
               npc.setTarget(player);
               npc.doCast(SkillTable.getInstance().getInfo(5627,1));   // Wind Walk
               npc.doCast(SkillTable.getInstance().getInfo(5628,1));   // Shield
               npc.doCast(SkillTable.getInstance().getInfo(5637,1));   // Magic Barrier
               npc.doCast(SkillTable.getInstance().getInfo(5633,1));   // Bless the Soul
               npc.doCast(SkillTable.getInstance().getInfo(5634,1));   // Acumen
               npc.doCast(SkillTable.getInstance().getInfo(5635,1));   // Concentration
               npc.doCast(SkillTable.getInstance().getInfo(5636,1));   // Empower
            }
            else
            {
               npc.setTarget(player);
               npc.doCast(SkillTable.getInstance().getInfo(5627,1));   // Wind Walk
               npc.doCast(SkillTable.getInstance().getInfo(5628,1));   // Shield
               npc.doCast(SkillTable.getInstance().getInfo(5637,1));   // Magic Barrier
               npc.doCast(SkillTable.getInstance().getInfo(5629,1));   // Bless the Body
               npc.doCast(SkillTable.getInstance().getInfo(5630,1));   // Vampiric Rage
               npc.doCast(SkillTable.getInstance().getInfo(5631,1));   // Regeneration
               npc.doCast(SkillTable.getInstance().getInfo(5632,1));   // Haste
            }
            htmltext = "4306-okbuff.htm";
         }
      }
      else if (event.equalsIgnoreCase("memories_summon"))
      {
         if (player.getLevel() < 76)
         {
            htmltext = "4306-nolevel.htm";
         }
         else if (player.getPet() == null || !(player.getPet() instanceof L2SummonInstance))
         {
            htmltext = "4306-nosummon.htm";
         }
         else
         {
            npc.setTarget(player.getPet());
            npc.doCast(SkillTable.getInstance().getInfo(5627,1));   // Wind Walk
            npc.doCast(SkillTable.getInstance().getInfo(5628,1));   // Shield
            npc.doCast(SkillTable.getInstance().getInfo(5637,1));   // Magic Barrier
            npc.doCast(SkillTable.getInstance().getInfo(5629,1));   // Bless the Body
            npc.doCast(SkillTable.getInstance().getInfo(5633,1));   // Bless the Soul
            npc.doCast(SkillTable.getInstance().getInfo(5630,1));   // Vampiric Rage
            npc.doCast(SkillTable.getInstance().getInfo(5634,1));   // Acumen
            npc.doCast(SkillTable.getInstance().getInfo(5631,1));   // Regeneration
            npc.doCast(SkillTable.getInstance().getInfo(5635,1));   // Concentration
            npc.doCast(SkillTable.getInstance().getInfo(5632,1));   // Haste
            npc.doCast(SkillTable.getInstance().getInfo(5636,1));   // Empower
            htmltext = "4306-okbuff.htm";
         }
      }
      
      return htmltext;
   }
   
   @Override
   public String onFirstTalk(L2Npc npc, L2PcInstance player)
   {
      QuestState st = player.getQuestState(getName());
      if (st == null)
      {
         Quest q = QuestManager.getInstance().getQuest(getName());
         st = q.newQuestState(player);
      }
      return "4306.htm";
   }
   
   public static void main(String[] args)
   {
      new GiftOfVitality(-1, "GiftOfVitality", "events");
   }
}


if anyone can help...

thanks a lot and sorry for my english
 
Newbie Spellweaver
Joined
Apr 2, 2013
Messages
5
Reaction score
0
I think i find the error in java


maybe its here

this line

Code:
[COLOR=#837E6E]String _streuse = (String) st.get("reuse");[/COLOR]

have to change with this
Code:
[COLOR=#AAAAAA]String _streuse = st.get("reuse");[/COLOR]

But after i get this error..

Code:
[COLOR=#AAAAAA]Type mismatch: cannot convert from object to string[/COLOR]

I also tried this after the error on main source code



model.quest.QuestState

I changed this :



Code:
/**
     * Return the value of the variable of quest represented by "var"
     * @param var : name of the variable of quest
     * @return Object
     */
    public Object get(String var)
    {
        if (_vars == null)
            return null;


        return _vars.get(var);
    }



with this :

Code:
[COLOR=#333333]/**[/COLOR]
[COLOR=#333333]* Return the value of the variable of quest represented by "var"[/COLOR]
[COLOR=#333333]* @param var : name of the variable of quest[/COLOR]
[COLOR=#333333]* @return String[/COLOR]
[COLOR=#333333]*/[/COLOR]
[COLOR=#333333]public String get(String var)[/COLOR]
[COLOR=#333333]{[/COLOR]
[COLOR=#333333]if (_vars == null)[/COLOR]
[COLOR=#333333]return null;[/COLOR]

[COLOR=#333333]return _vars.get(var);[/COLOR]
[COLOR=#333333]}[/COLOR]


but nothing

what i should do???
 
Upvote 0
Newbie Spellweaver
Joined
Apr 2, 2013
Messages
5
Reaction score
0
Problem fixed(all works fine)
If anyone has the same problem pm me :)
Locked it plz
 
Upvote 0
Status
Not open for further replies.
Back
Top