Jump to content

Recommended Posts

Posted

Requested σε pm και ειπα να το κανω share,ισως το θελει καποιος.

Ενα απλο npc που οποιος παιχτης παει διπλα του τον κανει heal αυτοματα χωρις target , τπτ.Επισης οποιος δει τον κωδικα και απορει αν ο κωδικας μπορει να φερει lag , η απαντηση ειναι ΟΧΙ και ο λογος ειναι οτι χιλιαδες tasks τρεχουν την ιδια ωρα.Σκεφτειτε οτι το baium κανει ανα 1-2 δευτερολεπτο actions που χρησιμοποιουν tasks.Αρα δεν υπαρχει προβλημα..

 

Type στο navicat: L2Healer

 

/*
* 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 net.sf.l2j.gameserver.model.actor.instance;

import java.util.concurrent.ScheduledFuture;

import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.serverpackets.MagicSkillUser;
import net.sf.l2j.gameserver.templates.L2NpcTemplate;

/**
* @author irat
*
*/
public class L2HealerInstance extends L2NpcInstance
{

private ScheduledFuture<?> _aiTask;

public L2HealerInstance(int objectId, L2NpcTemplate template)
{
	super(objectId, template);

	if (_aiTask != null)
            _aiTask.cancel(true);

    _aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new Heal(this), 3000, 3000);
}

public void deleteMe()
    {
       if (_aiTask != null)
        {
           _aiTask.cancel(true);
           _aiTask = null;
        }
    }

private class Heal implements Runnable
    {
        private L2HealerInstance _heal;

        protected Heal(L2HealerInstance caster)
        {
            _heal = caster;
        }

        public void run()
        {
        	L2Skill skill = SkillTable.getInstance().getInfo(1218, 1);
          for (L2PcInstance player : getKnownList().getKnownPlayersInRadius(100))
          {
                   if(player == null)
                	   continue;
                  
                 player.sendPacket(new MagicSkillUser(player, player, 1218, 1, skill.getHitTime(),0));
                 player.setCurrentHp(player.getMaxHp());
                 player.setCurrentCp(player.getMaxCp());
                 player.setCurrentMp(player.getMaxMp());
          }
      }
    }
}

 

 

Posted

Ti tha ginei omos ama poli pextes pali oloi mazi sto npc?Epeishs kalo tha itan na valeis kai merika restriction ;)

Posted

Ti tha ginei omos ama poli pextes pali oloi mazi sto npc?Epeishs kalo tha itan na valeis kai merika restriction ;)

restriction μπορει να βαλει ο καθενας πιστευω , απλα αυτο ειναι το βασικο δηλαδη το σημαντικο μερος.
  • 3 weeks later...
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock