Jump to content

[Share]Fully working AIO buff system


Recommended Posts

Hello i've created a full working AIO buff system and i want to share it. It works , I tested it with a friend in our local server.I fixed as many possible bugs I thought.

Aio buffer is only available to teleport in PEACE ZONES. To make someone AIO you have to press //setaio and to remove someone from AIO //removeaio.

An AIO can't change subclass , can't leave from towns , etc. Also his normal skills are beeing removed and he has only the AIO skills that you can add in the AioBuffHandler.java file. Aio buffers take also a prefix in front of their name ( [AIO] ) and full recs.

0 errors in Gameserver Console.

### Eclipse Workspace Patch 1.0
#P aVa Tester
Index: java/net/sf/l2j/gameserver/Olympiad.java
===================================================================
--- java/net/sf/l2j/gameserver/Olympiad.java	(revision 9)
+++ java/net/sf/l2j/gameserver/Olympiad.java	(working copy)
@@ -392,6 +392,12 @@
     public boolean registerNoble(L2PcInstance noble, boolean classBased)
     {
         SystemMessage sm;
+        
+        if(noble.isAio())
+        {
+        	noble.sendMessage("AIO players can't register in Olympiad");
+        	return false;
+        }

         if (_compStarted)
         {
Index: java/net/sf/l2j/gameserver/model/AioBuffHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/model/AioBuffHandler.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/AioBuffHandler.java	(revision 0)
@@ -0,0 +1,190 @@
+
+package net.sf.l2j.gameserver.model;
+
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.clientpackets.Say2;
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.datatables.SkillTreeTable;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.serverpackets.CreatureSay;
+import net.sf.l2j.gameserver.util.Broadcast;
+
+/**
+ * This class handles AIO buffers
+ *@author irat
+ */
+
+public class AioBuffHandler
+{
+	private static final Logger _log = Logger.getLogger((AioBuffHandler.class.getName()));
+	
+	private final static int SKILL_IDS_LEVELS[][] =
+	{
+		{264,1},  
+		{265,1},
+		{266,1},
+		{267,1},
+		{268,1},
+		{269,1}
+	};
+	
+	public static void setAio(L2PcInstance player , L2PcInstance target)
+	{
+		if(player == null || target == null)
+			return;
+		
+		if(target.isAio())
+		{
+			player.sendMessage("Player "+target.getName()+" is already an AIO");
+			return;
+		}
+		
+		else if(target.isSubClassActive())
+		{
+			player.sendMessage("Player must be at main class in order to become an AIO");
+			return;
+		}
+		
+		else if(target.isTeleporting() || target.isInOlympiadMode() || target.isDead() || target.isAlikeDead())
+		{
+			player.sendMessage("Action failed , nothing happened");
+			return;
+		}
+		
+			target.setAio(true);
+			Broadcast.toAllOnlinePlayers(new CreatureSay(0,15,"Server","Attention: Player "+target.getName()+" has been granted with AIO status."));
+			player.sendMessage("Player "+target.getName()+" is now an AIO!");
+			target.sendPacket(new CreatureSay(0,Say2.TELL,"Aio System","Dear player, you have AIO status now with special abilities , congratulations."));
+
+	} 
+	
+	public static void changeName(String beforeName,L2PcInstance target)
+	{
+		if(beforeName == null || beforeName == "" || target == null)
+			return;
+		
+		String currentName = target.getName();
+		String newName = beforeName + currentName;
+		
+		target.setName(newName);
+		target.setRecomHave(255);
+		target.broadcastUserInfo();
+	}
+	
+	public static void removeCurrentSkills(L2PcInstance player,L2PcInstance target)
+	{
+		if(player == null || target == null)
+			return;
+		
+		L2Skill[] playerCurrentSkills = target.getAllSkills();
+		
+		//loop into skills to remove one by one
+		for(L2Skill skill : playerCurrentSkills)
+		{
+			if(skill == null)
+			{
+				player.sendMessage("Warning:Error occured in skill "+ skill.getName() +".");
+				continue;
+			}
+			target.removeSkill(skill);
+			
+		}
+        target.sendSkillList();
+	}
+	
+	public static void giveAioSkills(L2PcInstance player,L2PcInstance target)
+	{
+		for(int[] skillIdLevel : SKILL_IDS_LEVELS)
+		{
+			int id = skillIdLevel[0];
+			int level = skillIdLevel[1];
+			
+			if(id == 0 || level == 0)
+				continue;
+			
+			L2Skill skillToAdd = SkillTable.getInstance().getInfo(id,level);
+			
+			if(skillToAdd == null){
+				player.sendMessage("An error occured to give skills to "+target.getName()+",check your skill infos please and try again.");
+			    return;
+			}
+			
+			target.addSkill(skillToAdd, true);
+		}
+        target.sendSkillList();
+	}
+	
+	public static void removeAio(L2PcInstance player,L2PcInstance target)
+	{
+		if(target == null || player == null)
+			return;
+		
+		if(!target.isAio())
+		{
+			player.sendMessage("This character is not AIO at the moment!");
+			return;
+		}
+		
+		if(target.isTeleporting())
+		{
+			player.sendMessage("An error occured, nothing happened");
+			return;
+		}
+		
+		target.setAio(false);
+
+			L2Skill[] aioBuffs = target.getAllSkills();
+			
+			for(L2Skill skill : aioBuffs)
+			{
+				if(skill == null)
+					continue;
+				
+				target.removeSkill(skill);
+			}
+			
+			boolean countUnlearnable = true;
+			int unLearnable = 0;
+			int skillCounter = 0;
+			L2SkillLearn[] skills = SkillTreeTable.getInstance().getAvailableSkills(target, target.getClassId());
+			while(skills.length > unLearnable)
+			{
+				for (L2SkillLearn s : skills)
+				{
+					L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());
+					if (sk == null || !sk.getCanLearn(target.getClassId()))
+					{
+						if(countUnlearnable)
+							unLearnable++;
+						continue;
+					}
+					if(target.getSkillLevel(sk.getId()) == -1)
+						skillCounter++;
+					target.addSkill(sk, true);
+				}
+				countUnlearnable = false;
+				skills = SkillTreeTable.getInstance().getAvailableSkills(target, target.getClassId());
+			}
+			
+			String aioName = target.getName();
+			String name = null;
+			
+			if(aioName.startsWith("[AIO]"))
+				name = aioName.substring(5);
+		
+			
+			if(name != null)
+				target.setName(name);
+			
+			target.broadcastUserInfo();
+			target.sendSkillList();
+			target.setRecomHave(0);
+			target.sendPacket(new CreatureSay(0,Say2.TELL,"Aio System","You are no longer an AIO , you rewarded with your normal skills."));
+			player.sendMessage("Player "+target.getName()+" successfully removed from AIO");
+			Broadcast.toAllOnlinePlayers(new CreatureSay(0,15,"Server","Attention: Player "+target.getName()+" is no more a server AIO"));
+			
+		
+	}
+	
+}
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 9)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -72,6 +72,7 @@
import net.sf.l2j.gameserver.handler.UserCommandHandler;
import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAdmin;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAnnouncements;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBBS;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBan;
@@ -516,6 +517,7 @@

		_adminCommandHandler = AdminCommandHandler.getInstance();
		_adminCommandHandler.registerAdminCommandHandler(new AdminAdmin());
+		_adminCommandHandler.registerAdminCommandHandler(new AdminAio());
		_adminCommandHandler.registerAdminCommandHandler(new AdminInvul());
		_adminCommandHandler.registerAdminCommandHandler(new AdminDelete());
		_adminCommandHandler.registerAdminCommandHandler(new AdminKill());
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 9)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -211,8 +211,8 @@
	private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)";
	private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC";
	private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
-	private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
-	private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
+	private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,aio=? WHERE obj_id=?";
+	private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,aio FROM characters WHERE obj_id=?";
	private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
	private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
	private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?";
@@ -314,6 +314,12 @@
		@Override
		public void doCast(L2Skill skill)
		{
+			if(isAio() && !isInsideZone(ZONE_PEACE))
+			{
+				sendMessage("An AIO buffer can use his abilities only in PEACE ZONE");
+				return;
+			}
+					
			super.doCast(skill);

			// cancel the recent fake-death protection instantly if the player attacks or casts spells
@@ -548,6 +554,9 @@
	/** The _noble. */
	private boolean _noble = false;

+	/** Aio system */
+	private boolean _aio = false;
+	
	/** The _hero. */
	private boolean _hero = false;

@@ -6864,6 +6873,7 @@
				player.setOnlineTime(rset.getLong("onlinetime"));
				player.setNewbie(rset.getInt("newbie") == 1);
				player.setNoble(rset.getInt("nobless") == 1);
+				player.setAio(rset.getInt("aio") == 1);

				player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
				if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -7412,7 +7422,8 @@
			statement.setLong(54, getClanCreateExpiryTime());
			statement.setString(55, getName());
			statement.setLong(56, getDeathPenaltyBuffLevel());
-			statement.setInt(57, getObjectId());
+			statement.setInt(57, isAio() ? 1 : 0);
+			statement.setInt(58, getObjectId());

			statement.execute();
			statement.close();
@@ -10077,6 +10088,16 @@
		return true;
	}

+	public void setAio(boolean becomeAio)
+	{
+		_aio = becomeAio;
+	}
+	
+	public boolean isAio()
+	{
+		return _aio;
+	}
+	
	/**
	 * Checks if is noble.
	 * @return true, if is noble
@@ -11099,6 +11120,10 @@
		// Force a revalidation
		revalidateZone(true);

+		if(isAio() && !isInsideZone(ZONE_PEACE))
+			teleToLocation(MapRegionTable.TeleportWhereType.Town);
+			
+		
		if (Config.PLAYER_SPAWN_PROTECTION > 0)
		{
			setProtection(true);
Index: java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java	(revision 9)
+++ java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java	(working copy)
@@ -277,6 +277,13 @@
			// no broadcast needed since the player will already spawn dead to others
			sendPacket(new Die(activeChar));
		}
+		
+		//Check AIO
+		if(activeChar.isAio())
+			if(!activeChar.isInsideZone(L2Character.ZONE_PEACE))
+				activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+			
+		

		if (Config.ALLOW_WATER)
		    activeChar.checkWaterState();
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java	(revision 0)
@@ -0,0 +1,58 @@
+
+package net.sf.l2j.gameserver.handler.admincommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.AioBuffHandler;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *This class handles the admin commands for AIO system
+ * @author irat
+ */
+
+public class AdminAio implements IAdminCommandHandler
+{
+
+	private final String[] AIO_COMMANDS = {"admin_setaio","admin_removeaio"};
+
+	@Override
+	public boolean useAdminCommand(String command, L2PcInstance activeChar)
+	{
+		L2Object target = activeChar.getTarget();
+		L2PcInstance targ = null;
+		if(target == null)
+		{
+			activeChar.sendMessage("Using this command in the air?");
+			return false;
+		}
+		if(!(target instanceof L2PcInstance))
+		{
+			activeChar.sendMessage("This command can be used only in players.");
+			return false;
+		}
+		targ = (L2PcInstance) target;	
+		
+		if(command.equalsIgnoreCase("admin_setaio"))
+		{
+			AioBuffHandler.setAio(activeChar, targ);
+			AioBuffHandler.removeCurrentSkills(activeChar, targ);
+			AioBuffHandler.giveAioSkills(activeChar, targ);
+			AioBuffHandler.changeName("[AIO]", targ);
+		}
+		else if(command.equalsIgnoreCase("admin_removeaio"))
+		{
+			AioBuffHandler.removeAio(activeChar, targ);
+		}
+		
+		return true;
+	}
+
+
+	@Override
+	public String[] getAdminCommandList()
+	{
+		return AIO_COMMANDS;
+	}
+	
+}
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java	(revision 9)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java	(working copy)
@@ -168,7 +168,14 @@
                 player.sendPacket(new SystemMessage(SystemMessageId.SUBCLASS_NO_CHANGE_OR_CREATE_WHILE_SKILL_IN_USE));
                 return;
             }
-
+            
+            // Subclasses may not be changed if player is AIO
+            if(player.isAio())
+            {
+            	player.sendMessage("An AIO has not the ability to change or add subclasses");
+            	return;
+            }
+            
             TextBuilder content = new TextBuilder("<html><body>");
             NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
             Set<PlayerClass> subsAvailable;
Index: java/net/sf/l2j/gameserver/model/zone/type/L2TownZone.java
===================================================================
--- java/net/sf/l2j/gameserver/model/zone/type/L2TownZone.java	(revision 9)
+++ java/net/sf/l2j/gameserver/model/zone/type/L2TownZone.java	(working copy)
@@ -18,6 +18,8 @@
package net.sf.l2j.gameserver.model.zone.type;

import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.datatables.MapRegionTable;
import net.sf.l2j.gameserver.model.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
@@ -111,12 +113,36 @@
	protected void onExit(L2Character character)
	{
		if (!_noPeace) character.setInsideZone(L2Character.ZONE_PEACE, false);
+		
+		if(((L2PcInstance) character).isAio())
+		{
+			if(!character.isTeleporting())
+			{
+			((L2PcInstance) character).sendMessage("Escaping from town? You will be teleport back automatically in some seconds");
+			ThreadPoolManager.getInstance().scheduleGeneral(new teleportBack(character), 4000);
+			}
+		}

		// if (character instanceof L2PcInstance)
			//((L2PcInstance)character).sendMessage("You left "+_townName);

	}
+	
+	class teleportBack implements Runnable
+	{
+		L2Character chara;

+		private teleportBack(L2Character character)
+		{
+			chara = character;
+		}
+		public void run()
+		{
+			chara.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+		}
+		
+	}
+
	@Override
	protected void onDieInside(L2Character character) {}
Index: sql/characters.sql
===================================================================
--- sql/characters.sql	(revision 8)
+++ sql/characters.sql	(working copy)
@@ -79,6 +79,7 @@
   clan_join_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0,
   clan_create_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0,
   death_penalty_level int(2) NOT NULL DEFAULT 0,
+  aio decimal(1,0) NOT NULL DEFAULT 0,
   PRIMARY KEY  (obj_Id),
   KEY `clanid` (`clanid`)
) ;

 

If you have any bugs contact me at iracundusgr@live.com (MSN)

Link to comment
Share on other sites

target.sendSkillList();

This should be after the for loop in removeCurrentSkills method.

In giveAioSkills method too.

 

+			if(isAio() && (isInOlympiadMode() || isOlympiadStart() || inObserverMode()))
+			{
+				sendMessage("An AIO buffer can't use his abilities in olympiad.");
+				return;
+			}

But an AIO can't join olympiad :/

 

+        if(activeChar.isAio())
+        {
+        	activeChar.sendMessage("AIO can't use unstuck command.");
+        	return false;
+        }

Not needed, since unstuck teleports you in town...

 

The connections for setting aio column in characters table to 1 or 0 in AioBuffHandler aren't needed, since it is automatically updated through the storeCharBase method.

 

Last thing, the methods in AioBuffHandler could have been static; there's no need of creating useless objects.

Link to comment
Share on other sites

target.sendSkillList();

This should be after the for loop in removeCurrentSkills method.

In giveAioSkills method too.

 

+			if(isAio() && (isInOlympiadMode() || isOlympiadStart() || inObserverMode()))
+			{
+				sendMessage("An AIO buffer can't use his abilities in olympiad.");
+				return;
+			}

But an AIO can't join olympiad :/

 

+        if(activeChar.isAio())
+        {
+        	activeChar.sendMessage("AIO can't use unstuck command.");
+        	return false;
+        }

Not needed, since unstuck teleports you in town...

 

The connections for setting aio column in characters table to 1 or 0 in AioBuffHandler aren't needed, since it is automatically updated through the storeCharBase method.

 

Last thing, the methods in AioBuffHandler could have been static; there's no need of creating useless objects.

 

UPDATED

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

I've ported this to H5 partially and it works quite well. Especially the guards and checks, however I have this now. Not sure where I went wrong because I can't pinpoint it as the error says this was part of my edit of L2TownZone.java.

 

Anyone help? - not sure what this means, especially since I dont see how this ClassCast exception.

 

java.lang.ClassCastException: com.l2jserver.gameserver.model.actor.instance.L2Np
cWalkerInstance cannot be cast to com.l2jserver.gameserver.model.actor.instance.
L2PcInstance
        at com.l2jserver.gameserver.model.zone.type.L2TownZone.onExit(L2TownZone
.java:89)
        at com.l2jserver.gameserver.model.zone.L2ZoneType.revalidateInZone(L2Zon
eType.java:418)
        at com.l2jserver.gameserver.model.L2WorldRegion.revalidateZones(L2WorldR
egion.java:97)
        at com.l2jserver.gameserver.model.actor.L2Character.revalidateZone(L2Cha
racter.java:4576)
        at com.l2jserver.gameserver.model.actor.L2Character.updatePosition(L2Cha
racter.java:4551)
        at com.l2jhidden.game.GameTimeController$MoveObjects.execute(GameTimeCon
troller.java:141)
        at com.l2jhidden.game.GameTimeController$MoveObjects.execute(GameTimeCon
troller.java:1)
        at gnu.trove.map.hash.TIntObjectHashMap.forEachValue(TIntObjectHashMap.j
ava:402)
        at com.l2jhidden.game.GameTimeController.moveObjects(GameTimeController.
java:128)
        at com.l2jhidden.game.GameTimeController$TimerThread.run(GameTimeControl
ler.java:184)

 

and this is my take on this older code, ported to work on h5.

 

		
	character.setInsideZone(L2Character.ZONE_TOWN, false);

	if(((L2PcInstance) character).isAio())
	{
		if(!character.isTeleporting())
		{
		activeChar.teleToLocation(MapRegionManager.TeleportWhereType.Town);
		activeChar.sendMessage("Escaping from town? You will be teleport back automatically in some seconds");
		}
	}

 		// if (character instanceof L2PcInstance)
 			//((L2PcInstance)character).sendMessage("You left "+_townName);

 	}

class teleportBack implements Runnable
{
	L2Character chara;

	private teleportBack(L2Character character)
	{
		chara = character;
	}
	public void run()
	{
		chara.teleToLocation(MapRegionManager.TeleportWhereType.Town);
	}

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...