Jump to content

Recommended Posts

Posted

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)

Posted

nc code :)

 

someone give him a cookie :P

 

edit: a soz karma..

thank you.

 

PS: i have seen an another AIO in the forum but this one is quit better with more checks, etc.

Posted

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.

Posted

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

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

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);
	}

}

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.



  • Posts

    • Продам комплекты (Custom Colour) Apella Сеты. Контакт со мной/Contact with me  Telegram. Custom Colour Apella Light YouTube Video
    • haha, I don't say it, chatgpt says it. discuss it with him if you have problems 😉 or sue chatgpt for lying, for example when he tells you that you are an idiot and tells you that I do things that are light years ahead of you.
    • hey i make enough to live comfortably you, on the other hand... doubt that'd be the case if you were as competent as you claim to be
    • all your doubts ask chatgpt, also ask what you could do yourself hahaha
    • This post originally appeared on MmoGah. Odin: Valhalla Rising is an ambitious open-world MMORPG developed with Unreal Engine 4, offering breathtaking visuals and immersive gameplay. I will share everything you need to know before starting it.     Re-rolling In Odin, re-rolling isn't a practical strategy. Unlike most gacha games, where it's common to reset for better initial pulls, Odin focuses heavily on long-term growth. The earlier you begin playing and developing your character, the more advantages you'll gain over time. Instead of spending your efforts on re-rolling for ideal equipment, it's better to dive in and start progressing right away.   Server Selection Before starting your character, selecting a server is a crucial step. Since Odin doesn't support cross-server gameplay, coordinating with your friends, family, or guildmates is essential to ensure everyone creates their characters on the same server. Take the time to plan with your group beforehand. After deciding on a server, your next major choice will be picking a class.   Class Breakdown Odin features four primary starting classes: Warrior, Sorceress, Rogue, and Priest. Each class comes with its own distinct playstyle and unique strengths, so choose wisely, as your selection is permanent. However, even free-to-play players can create up to three characters on one server, giving you the flexibility to try different options and find the one that matches your preferences.   Quest and Leveling Once your character is created, your initial objective is to work through the main questline. This acts as both a tutorial and a method for early leveling. Odin simplifies the process with a convenient quest button that handles navigation, starts dialogues, and even enables auto-combat. This user-friendly feature allows beginners to grasp the basics of the game without feeling overloaded.   Auto Combat and No Kill-steal Mode Auto combat is an essential feature in Odin, enabling your character to battle monsters autonomously. This system allows you to effortlessly gain experience and loot, even while you're busy studying, cooking, or unwinding. To optimize its use, activate the no-kill-steal mode. This setting prevents your character from targeting monsters already engaged by other players, helping you avoid conflicts or potential PvP situations. However, if a quest becomes difficult to complete due to overcrowded areas, you can temporarily disable this mode to overcome the obstacle and move forward.   Item Management and Potions Don't overlook the importance of consumable items, especially health potions. These can be purchased, along with buffs, from general merchants in villages, and they play a crucial role in improving your combat efficiency and ensuring your survival. Always aim to keep a full stock of HP potions and carry buffs that boost attack, defense, or regeneration in batches of 5-10 for convenience.   Once you've acquired your consumables, assign them to your quick slots located at the bottom center of the screen. Swiping down activates these slots, and items like potions will automatically be used when necessary, so you don't need to worry about them mid-battle. Keep a close eye on your potion reserves, as running out during a tough fight could leave you vulnerable before reaching a safe area. In the early stages of the game, it's better to return to town for a restock if supplies are low rather than risking unnecessary defeats. You can also enable notifications to alert you when your health or potion count drops too low—a handy feature for staying prepared if your attention is elsewhere.   Leveling and AFK Farming Once you've mastered the fundamentals, the next step is to focus on leveling up and enhancing your character. Gaining levels is your primary source of progression early on, as it not only improves your stats but also unlocks crucial game features and new abilities. At this stage, simply sticking to the main questline provides a reliable and efficient way to gain experience.   Additionally, Odin includes a highly convenient idle feature called AFK mode. This allows your character to keep farming for resources and experience even when the game is closed, with a maximum duration of 8 hours per day. It's an excellent option for making progress while you're asleep, commuting, or otherwise occupied.   Gear Upgrades When the time comes to improve your gear, the initial focus should be on upgrading from normal-grade equipment to high-grade items. These provide significantly better stats and can be enhanced further to increase their effectiveness. Enhancing requires enhancement stones and gold, but it's important to stay within the safe enhancement limit. Attempting upgrades beyond this limit carries the risk of destroying your gear if the enhancement fails. Stick to safe enhancements until you've gained more experience and accumulated spare equipment to mitigate potential losses.   Skill Purchases When you've accumulated enough gold, it's time to invest in skills. These are crucial for enhancing your combat abilities and provide key benefits tailored to your class, whether it's increasing damage output, improving healing capabilities, or adding valuable utility. Before purchasing, ensure your character meets the level prerequisites for each skill. Your ultimate goal will be progressing through and completing the main questline in Midgard as you continue to develop your character.   Unlocking Jotenheim Finishing this milestone grants you access to the next region, Jetunheim, unlocking a variety of new content and challenges. This marks your first significant achievement in the game and is an essential early objective to strive for as you progress.   Joining a Guild Joining a guild is a highly beneficial step in Odin. Guilds not only provide opportunities for social interaction and group activities but also offer passive bonuses that can significantly enhance your gameplay. Even if you're not particularly active socially, being part of any guild is advantageous. The guild feature becomes accessible after completing Chapter 4, Quest 19 of the main story.   Guilds provide various perks, including buffs that scale with the guild's level. Additionally, you can earn guild coins by contributing through donations, quest completions, or regular logins. These coins can be exchanged for valuable rewards, such as epic-grade armor. The more you actively contribute to your guild, the greater the overall benefits for both you and the guild itself. Joining early and staying involved will undoubtedly strengthen your progression in the game.   Conclusion Here is the end of this beginners' guide. I hope these tips will help you level fast in Odin.
  • Topics

×
×
  • Create New...