Jump to content
  • 0

Hero Custom Day L2Jfrozen For L2Jacis


Question

Posted

I took this code in another forum, however added is of the same error that the low image

5PLx7qm.jpg

 

Code:

 

 

# -----------------------------------------------------

# Hero Custom Item Configuration -
# -----------------------------------------------------
# When ActiveChar will use this item will gain Hero Status.
EnableHeroCustomItem = False
# Id Itemn Need's 
HeroCustomItemId = 3481
# Hero for X days, 0 forever.
HeroCustomDay = 0
 
 
 
config.java
 
+public static boolean HERO_CUSTOM_ITEMS;
+public static int HERO_CUSTOM_ITEM_ID;
+public static int HERO_CUSTOM_DAY;
 
+HERO_CUSTOM_ITEMS = Boolean.parseBoolean(L2JFrozenSettings.getProperty("EnableHeroCustomItem", "true"));
+HERO_CUSTOM_ITEM_ID = Integer.parseInt(L2JFrozenSettings.getProperty("HeroCustomItemId", "3481"));
+HERO_CUSTOM_DAY = Integer.parseInt(L2JFrozenSettings.getProperty("HeroCustomDay", "0"));
 
 
 
 
 
 
gameserver.handler.ItemHandler.java
 
 
+import com.l2jfrozen.gameserver.handler.itemhandlers.HeroCustomItem;
 
 
 
 
registerItemHandler(new JackpotSeed());
  +registerItemHandler(new HeroCustomItem());
registerItemHandler(new MOSKey());
registerItemHandler(new BreakingArrow());
 
 
 
 
L2DatabaseFactory.java
 
public static void close(final Connection con)
{
if (con == null)
return;
 
try
{
con.close();
}
catch (final SQLException e)
{
_log.warning("Failed to close database connection!");
}
}
 
+/**
+ * @param b
+ * @return
+ * @throws SQLException 
+ */
+public Connection getConnection(boolean B) throws SQLException
+{
+ return getConnection(true);
+}
}
 
 
 
instance.L2PcInstance.java
 
// "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,pc_point,banchat_time,name_color,title_color,first_log,aio,aio_end FROM characters 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,punish_level,punish_timer," + /*
+
+/** The Constant STATUS_DATA_GET. */
+private static final String STATUS_DATA_GET = "SELECT hero, hero_end_date FROM characters_custom_data WHERE obj_Id = ?";
+
/** The Constant RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS. */
private static final String RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? ORDER BY (skill_level+0)";
 
// ---------------------- L2JFrozen Addons ---------------------------------- //
/** The Constant RESTORE_CHAR_SUBCLASSES. */
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";
 
 
public void reduceDeathPenaltyBuffLevel()
{
if (getDeathPenaltyBuffLevel() <= 0)
return;
 
L2Skill skill = SkillTable.getInstance().getInfo(5076, getDeathPenaltyBuffLevel());
 
if (skill != null)
{
removeSkill(skill, true);
skill = null;
sendSkillList();
}
 
_deathPenaltyBuffLevel--;
 
if (getDeathPenaltyBuffLevel() > 0)
{
addSkill(SkillTable.getInstance().getInfo(5076, getDeathPenaltyBuffLevel()), false);
sendPacket(new EtcStatusUpdate(this));
SystemMessage sm = new SystemMessage(SystemMessageId.DEATH_PENALTY_LEVEL_S1_ADDED);
sm.addNumber(getDeathPenaltyBuffLevel());
sendPacket(sm);
sm = null;
sendSkillList();
}
else
{
sendPacket(new EtcStatusUpdate(this));
sendPacket(new SystemMessage(SystemMessageId.DEATH_PENALTY_LIFTED));
}
}
 
+/**
+* restore all Custom Data hero.
+*/
+public void restoreCustomStatus()
+{
+ if (Config.DEVELOPER)
+ {
+ _log.info("Restoring character status " + getName() + " from database...");
+ }
+ int hero = 0;
+ long hero_end = 0;
+ Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection(false);
+ PreparedStatement statement = con.prepareStatement(STATUS_DATA_GET);
+ statement.setInt(1, getObjectId());
+ ResultSet rset = statement.executeQuery();
+ while (rset.next())
+ {
+ hero = rset.getInt("hero");
+ hero_end = rset.getLong("hero_end_date");
+ }
+ rset.close();
+ statement.close();
+ statement = null;
+ rset = null;
+ }
+ catch (final Exception e)
+ {
+ e.printStackTrace();
+ _log.warning("Error: could not restore char custom data info: " + e);
+ }
+ finally
+ {
+ try
+ {
+ if (con != null)
+ con.close();
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ if (hero > 0 && (hero_end == 0 || hero_end > System.currentTimeMillis()))
+ {
+ setHero(true);
+ }
+ else
+ {
+ // delete wings of destiny
+ destroyItem("HeroEnd", 6842, 1, null, false);
+ }
+}
/**
* Restore death penalty buff level.
*/
public void restoreDeathPenaltyBuffLevel()
{
L2Skill skill = SkillTable.getInstance().getInfo(5076, getDeathPenaltyBuffLevel());
 
if (skill != null)
{
removeSkill(skill, true);
skill = null;
}
 
 
 
 
 
 
 
 
+net.sf.l2j.gameserver.handler.itemhandlers.HeroCustomItem.java
 
// Hero Custom Item , Created By Stefoulis15
// Added From Stefoulis15 Into The Core.
// Visit www.MaxCheaters.com For Support 
// Source File Name:   HeroCustomItem.java
// Modded by programmos, sword dev
 
package net.sf.l2j.gameserver.handler.itemhandlers;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Logger;
 
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.L2Playable;
import net.sf.l2j.L2DatabaseFactory;
 
public class HeroCustomItem implements IItemHandler
{
 
public HeroCustomItem()
{
// null
}
 
protected static final Logger _log = Logger.getLogger(HeroCustomItem.class.getName());
 
String INSERT_DATA = "REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator, hero_end_date) VALUES (?,?,?,?,?,?)";
 
@Override
public void useItem(L2Playable playable, ItemInstance item, boolean forceUse)
{
if (Config.HERO_CUSTOM_ITEMS)
{
if (!(playable instanceof L2PcInstance))
return;
 
L2PcInstance activeChar = (L2PcInstance) playable;
 
if (activeChar.isInOlympiadMode())
{
activeChar.sendMessage("This Item Cannot Be Used On Olympiad Games.");
}
 
if (activeChar.isHero())
{
activeChar.sendMessage("You Are Already A Hero!.");
}
else
{
activeChar.setHero(true);
updateDatabase(activeChar, Config.HERO_CUSTOM_DAY * 24L * 60L * 60L * 1000L);
activeChar.sendMessage("You Are Now a Hero,You Are Granted With Hero Status , Skills ,Aura.");
activeChar.broadcastUserInfo();
playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
activeChar.getInventory().addItem("Wings", 6842, 1, activeChar, null);
}
activeChar = null;
}
}
 
public int[] getItemIds()
{
return ITEM_IDS;
}
 
private void updateDatabase(final L2PcInstance player, final long heroTime)
{
Connection con = null;
try
{
if (player == null)
return;
 
con = L2DatabaseFactory.getInstance().getConnection(false);
PreparedStatement stmt = con.prepareStatement(INSERT_DATA);
 
stmt.setInt(1, player.getObjectId());
stmt.setString(2, player.getName());
stmt.setInt(3, 1);
stmt.setLong(4, heroTime == 0 ? 0 : System.currentTimeMillis() + heroTime);
stmt.execute();
stmt.close();
stmt = null;
}
catch (final Exception e)
{
e.printStackTrace();
 
_log.warning("Error: could not update database: " + e);
}
finally
{
try
{
if (con != null)
con.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
 
private static final int ITEM_IDS[] =
{
Config.HERO_CUSTOM_ITEM_ID
};
 
}
 
 
 
 
 
XML
 
    <item id="3481" type="EtcItem" name="Heroi">
        <set name="material" val="GOLD" />
        <set name="is_stackable" val="true" />
        <set name="is_depositable" val="false" />
        <set name="is_dropable" val="false" />
        <set name="handler" val="HeroCustomItem" />
    </item>
 
 
characters_custom_data.sql
 
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `characters_custom_data`
-- ----------------------------
DROP TABLE IF EXISTS `characters_custom_data`;
CREATE TABLE `characters_custom_data` (
  `obj_Id` decimal(11,0) NOT NULL DEFAULT '0',
  `char_name` varchar(35) NOT NULL DEFAULT '',
  `hero` decimal(1,0) NOT NULL DEFAULT '0',
  `hero_end_date` bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`obj_Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-- ----------------------------
-- Records of characters_custom_data
-- ----------------------------
 

 

 

 

someone could tell me what problem or solution to this? if possible I will thank a lot.

4 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.


  • Posts

    • I have and selling the CMS that was used on the real L2Nostalgia.com server from 2012 and the PlusOneL2 project website and server files 🙂 if u are interested PM ME.  
    • Interlude x15 –  No soy el administrador de este servidor, pero es un nuevo proyecto que está muy bien configurado — ¡solo necesita una comunidad! Si estás buscando una experiencia nueva, equilibrada y emocionante en Interlude, este es el lugar. ¡Participa! Únete al servidor Trae tu clan o equipo ¡Ayuda a que el servidor crezca!   Fecha de Apertura 16 de Mayo de 2025 Horario de Apertura 19:00 GMT-3 Versión del Juego Interlude Versión de la Interfaz Classic (protocolo 166) Rates de EXP y SP Dinámicos Niveles 1 al 19: EXP 15, SP 10 Niveles 20 al 39: EXP 13, SP 7 Niveles 40 al 51: EXP 11, SP 3 Niveles 52 al 60: EXP 9, SP 3 Niveles 61 al 75: EXP 7, SP 1.5 Niveles 76+: EXP 2, SP 1 Otros Rates Adena: x1 Chance de Drop: x1 Chance de Spoil: x1 Cantidad de SealStone: x2 RB XP/SP: x3 RB Drop: x2 Configuraciones Únicas Hasta 3 cuentas por PC (2 gratis + 1 paga) Sistema de Enchant skill desactivado Sistema de Augment weapon desactivado Mana potion: efecto de 2000, reutilización de 15 segundos Sin auto-learn skill SP y Book para aprender skills Quests 1ª y 2ª Transferencia de Clase por Adena 3ª Transferencia de Clase por 700 Halisha Marks Subclase custom: solo hablar con las cajas de los 4 jefes Nobles Retail Recompensa de Transferencia de Profesión Recibe un ticket de 1ª profesión (artículos del starter pack) Recibe un ticket de 2ª profesión (Montura de Clase) Mejoras en el Auto-farm Hemos reestructurado la IA del auto-farm Corregida la zona de caza Configuraciones de alcance de la caza automática Clanes y Alianzas Máximo de miembros por clan: 25 miembros Máximo de clanes por alianza: 1 clan El clan ya inicia nivel 8, sin reputación y sin skills Comandos Dentro del Juego .cfg - Para ajustar configuraciones del juego .instancezone - Verificar el tiempo de instancias .sellbuff - Para comenzar a vender buffs .topclan - Para verificar el top clan .acp - Para usar el sistema de auto potion Bono de EXP Extra en la Party 6 miembros: 20% 7 miembros: 30% 8 miembros: 40% 9 miembros: 50% NPC Buff Duración: 1 hora Total de buffs: 24 + 4 (Divine Inspiration) Buffs básicos sin protección y sin profecías   Join  >> DISCORD <<    
    • 🚀 MoMoProxy Static Residential Proxies For Sale!     🔹 Stable, secure & high-anonymity 🔹 >10Mbps speed, <10ms latency 🔹 99.99% uptime & static IPs 🔹 Unlimited traffic & connections 🌍 30M+ clean residential IPs ✅ Whitelist & user/pass auth 💳 Flexible plans (7/30/90 days) 💰 From $3/IP (Pay-per-IP) 🔥 Perfect for: ✔️ Ad verification ✔️ E-commerce/social media ✔️ Data scraping ✔️ Anti-detect browsers 🆓 Start free trial today! 🔗 [Insert Link] #Proxy #ResidentialProxies #WebScraping #DigitalMarketing   1/ Why Choose MoMoProxy? ✅ Global ISP network (30M+ IPs) ✅ Dedicated dashboard for easy management ✅ 24/7 stable operation ✅ HTTP(S)/SOCKS5 support 2/ Use Cases: 📊 Ad fraud detection 🛒 Sneaker copping & e-com 📱 Social media automation 🌐 Travel aggregation & more! 3/ Get Started in 4 Steps: A. Pick MoMoProxy B. Grab your IP credentials C. Configure your tool D. Enjoy unlimited sessions!   https://momoproxy.com/static-residential-proxies https://momoproxy.com/static-residential-proxies https://momoproxy.com/static-residential-proxies    
    • ➡ Discount for your purchase: MAY2025 (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • ➡ Discount for your purchase: MAY2025 (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
  • Topics

×
×
  • Create New...