Jump to content
  • 0

Question about heroes


Question

10 answers to this question

Recommended Posts

  • 0
Posted

I didn't checked at all, but you surely need to recode some parts, because hero table is cleaned each time Olympiad occurs...

 

Baiscally, heroes are put heroes in EnterWorld, using database entries.

 

In the "hero clean section when olympiad occurs" you have to add a special symbol in an existing column "if column blabla == 999 don't delete the line", or to add a new column.

  • 0
Posted

should be

 

setHero(true)

 

example :

 

if (!isHero() && getLevel() == 80)

{

setHero(true);

rewardSkills();

}

 

just an example

 

 

sorry did misunderstood your question. try as matim said

  • 0
Posted

Or create your own "permanent heroes" table, with players with this stored there.

 

Or just as Tryskell said.

  • 0
Posted

the only "code" which exists for heroes into enterworld is this one

// Set Hero status if it applies

if (Hero.getInstance().getHeroes() != null && Hero.getInstance().getHeroes().containsKey(activeChar.getObjectId()))

activeChar.setHero(true);

 

setPledgeClass(activeChar);

 

so, what do you mean tryskell by adding a special symbol in an existing column? there isnt any column same as you told...

as for creating a new column, i didnt understand exactly what you mean matim...

  • 0
Posted

Index: java/com/l2jserver/gameserver/GameServer.java
===================================================================
--- java/com/l2jserver/gameserver/GameServer.java	(revision 4492)
+++ java/com/l2jserver/gameserver/GameServer.java	(working copy)
@@ -41,6 +41,7 @@
import com.l2jserver.gameserver.datatables.CharNameTable;
import com.l2jserver.gameserver.datatables.CharTemplateTable;
import com.l2jserver.gameserver.datatables.ClanTable;
+import com.l2jserver.gameserver.datatables.CustomHeroTable;
import com.l2jserver.gameserver.datatables.DoorTable;
import com.l2jserver.gameserver.datatables.EnchantGroupsTable;
import com.l2jserver.gameserver.datatables.EnchantHPBonusData;
@@ -405,6 +406,7 @@

		TvTManager.getInstance();
		KnownListUpdateTaskManager.getInstance();
+		CustomHeroTable.getInstance();

		if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
			OfflineTradersTable.restoreOfflineTraders();
Index: java/com/l2jserver/gameserver/Shutdown.java
===================================================================
--- java/com/l2jserver/gameserver/Shutdown.java	(revision 4492)
+++ java/com/l2jserver/gameserver/Shutdown.java	(working copy)
@@ -21,6 +21,7 @@
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.datatables.ClanTable;
+import com.l2jserver.gameserver.datatables.CustomHeroTable;
import com.l2jserver.gameserver.datatables.OfflineTradersTable;
import com.l2jserver.gameserver.instancemanager.CastleManorManager;
import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
@@ -539,6 +540,8 @@
		ClanTable.getInstance().storeClanScore();
		_log.info("Clan System: Data saved!!");

+		CustomHeroTable.getInstance().saveHeros();
+		
		// Save Cursed Weapons data before closing.
		CursedWeaponsManager.getInstance().saveData();

Index: java/com/l2jserver/gameserver/datatables/CustomHeroTable.java
===================================================================
--- java/com/l2jserver/gameserver/datatables/CustomHeroTable.java	(revision 0)
+++ java/com/l2jserver/gameserver/datatables/CustomHeroTable.java	(revision 0)
@@ -0,0 +1,127 @@
+package com.l2jserver.gameserver.datatables;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+public class CustomHeroTable
+{
+	private static final class SingletonHolder
+	{
+		private static final CustomHeroTable INSTANCE = new CustomHeroTable();
+	}
+	
+	private static final Logger _log = Logger.getLogger(CustomHeroTable.class.getName());
+	
+	private static final String SQL_LOAD_HERO = "SELECT objecId FROM custom_hero";
+	private static final String SQL_DEL_HERO = "DELETE FROM custom_hero";
+	private static final String SQL_SAVE_HERO = "INSERT INTO custom_hero VALUES ( ? )";
+	
+	private Set<Integer> _heros;
+	
+	private CustomHeroTable()
+	{
+		_heros = new HashSet<Integer>();
+		loadHeros();
+	}
+	
+	private final void loadHeros()
+	{
+		Connection con = null;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement st = con.prepareStatement(SQL_LOAD_HERO);
+			ResultSet rset = st.executeQuery();
+			while(rset.next())
+			{
+				final int objId = rset.getInt("objectId");
+				if(!addHero(objId))
+					_log.warning(">>> CustomHeroTable.loadHeros(): Duplicated object id in custom_hero table!");
+			}
+			_log.config("CustomHeroTable: Loaded "+_heros.size()+" custom Heroes!");
+		}
+		catch(SQLException e)
+		{
+			_log.log(Level.SEVERE, "CustomHeroTable.loadHeros()", e);
+		}
+		finally
+		{
+			L2DatabaseFactory.close(con);
+		}
+	}
+	
+	public final void saveHeros()
+	{
+		Connection con = null;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			
+			PreparedStatement st = con.prepareStatement(SQL_DEL_HERO);
+			st.execute();
+			st.close();
+			
+			for(int hero : _heros)
+			{
+				PreparedStatement heroSt = con.prepareStatement(SQL_SAVE_HERO);
+				heroSt.setInt(1, hero);
+				heroSt.execute();
+				heroSt.close();
+			}
+			_log.config("CustomHeroTable: Suscessfully saved "+_heros.size()+" custom Heroes to database!");
+		}
+		catch(SQLException e)
+		{
+			_log.log(Level.SEVERE, "CustomHeroTable.saveHeros()", e);
+		}
+		finally
+		{
+			L2DatabaseFactory.close(con);
+		}
+	}
+	
+	public void onEnter(L2PcInstance plr)
+	{
+		if(_heros.contains(plr.getObjectId()))
+			plr.setHero(true);
+	}
+	
+	/*
+	 * Following methods may be used for admin commands
+	 * or the way to become custom hero for example 
+	 */
+	
+	public boolean addHero(L2PcInstance plr)
+	{
+		return addHero(plr.getObjectId());
+	}
+	
+	public boolean addHero(int objectId)
+	{
+		return _heros.add(objectId);
+	}
+	
+	public boolean removeHero(L2PcInstance plr)
+	{
+		return removeHero(plr.getObjectId());
+	}
+	
+	public boolean removeHero(int objectId)
+	{
+		return _heros.remove(objectId);
+	}
+	
+	public static CustomHeroTable getInstance()
+	{
+		return SingletonHolder.INSTANCE;
+	}
+}
Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java	(revision 4492)
+++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -27,6 +27,7 @@
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.communitybbs.Manager.RegionBBSManager;
import com.l2jserver.gameserver.datatables.AdminCommandAccessRights;
+import com.l2jserver.gameserver.datatables.CustomHeroTable;
import com.l2jserver.gameserver.datatables.GMSkillTable;
import com.l2jserver.gameserver.datatables.MapRegionTable;
import com.l2jserver.gameserver.datatables.SkillTable;
@@ -188,6 +189,8 @@
		if (activeChar.getCurrentHp() < 0.5)
			activeChar.setIsDead(true);

+		CustomHeroTable.getInstance().onEnter(activeChar);
+		
		boolean showClanNotice = false;

		// Clan related checks are here

l2jserver, freya last revision

  • 0
Posted

to apply and run this code you have to create a new table in database called custom_hero (with 1 column called objectId (INT, 10))

Those object ids from players who you add there will be permanent heros

Guest
This topic is now closed to further replies.


  • Posts

    • That domainn tho :_D
    • Perfect way to experience L2 without the brutal official grind. The progression here is so much smoother and faster, you get to the fun PvP and epic raids way quicker. The custom stuff keeps it fresh too. Definitely worth diving into!
    • L2-Getwork server highly customized with high-stats https://l2server.eu/ https://discord.gg/SsVhm7R Rates: L2 High Five fully customized Getwork Style with High Stats and Enchant ExP/Sp: 75x (custom) Drop/Spoil: 1x (custom) Safe: 500 Max: 50 000   Enchant System: Normal Scrolls: 93% - fail - decrease enchant by 20 Blessed Scrolls: 96% - fail - decrease enchant by 10   Armor Max Enchant D-Grade: +1000 Max Enchant C-Grade: +2000 Max Enchant B-Grade: +3000 Max Enchant A-Grade: +4000 Max Enchant S-Grade: +5000   Weapons Max Enchant D-Grade: +5000 Max Enchant C-Grade: +10000 Max Enchant B-Grade: +15000 Max Enchant A-Grade: +20000 Max Enchant S-Grade: +25000 - 50000   Fir Tree Branch (Weapon): +100 into Weapons (max 50 000) Fir Tree Branch (Armor): +15 into Armor (max 5000) Road to Dvc Cloak Enchant: +1 into cloak (max +1000) Masks of Spirit/Demon Horns Enchants: +1 into Masks (max +10) Each accessories has different max enchant and chances Daily Missions (.missions) Collections (ALT + B) Gambling System(.gamble) - each pack cost different amount Gamble Points, different items How to get gambling points? - by killing Raid Bosses/Events or Completing Daily Missions. Clan Bonus VIP Bonuses (maximum level 10) Battlepass (maximum level 100) - by killing monsters Rebirth (starting in Parnassus) Everything in ALT+B Master's Buffs - 100 Small Glass Box (1 buff) Farm Zones: Custom Farm Zones: Ruin of Agony (Exp Zone) Underground Coliseum (Safe Exp Zone) DVC,Brigand,Frost are similiar farm zones with same monsters Dvc Brigand Stronghold Frost Lake Parnassus - TOP ZONE some of our features: .gamble,collections,battlepass,talent tree, rebirth        
    • https://www.mediafire.com/file/l905r1sd84hnovf/FileEdit.rar/file
  • Topics

×
×
  • 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