Jump to content
  • 0

[Help] Legend system


Question

Posted

Hello! I tried to add Stefoulis15 Legend System but it seems it doesn't do anything :P Can someone help? Here is my patch:

Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 1475)
+++ java/config/l2jmods.properties	(working copy)
@@ -275,6 +275,28 @@
ManaPotionLevel = 1

# ---------------------------------------------------------------------------
+# Legend System
+# ---------------------------------------------------------------------------
+
+# Custom Legends Title?
+LegendTitle = -Legend-
+
+# Custom Legends Title Color?
+# Values are In RGB Format. Max For Very Int is 255
+LegendTitleColorRed = 0
+LegendTitleColorGreen = 0
+LegendTitleColorBlue = 0
+
+# Custom Legends Name Color?
+# Values are In RGB Format. Max For Very Int is 255
+LegendNameColorRed = 0
+LegendNameColorGreen = 0
+LegendNameColorBlue = 0
+
+# Legends Vitality Level?
+LegendVitalityLevel = 4
+
+# ---------------------------------------------------------------------------
# Welcome message
# ---------------------------------------------------------------------------
# Allow screen welcome message?
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 1475)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -646,6 +646,14 @@
	public static boolean OFFLINE_TRADE_ENABLE;
	public static boolean OFFLINE_CRAFT_ENABLE;
	public static boolean OFFLINE_SET_NAME_COLOR;
+	//public static String LEGEND_TITLE;
+	public static int LEGEND_TITLE_COLOR_RED;
+	public static int LEGEND_TITLE_COLOR_GREEN;
+	public static int LEGEND_TITLE_COLOR_BLUE;
+	public static int LEGEND_NAME_COLOR_RED;
+	public static int LEGEND_NAME_COLOR_GREEN;
+	public static int LEGEND_NAME_COLOR_BLUE;
+	//public static int LEGEND_VITALITY_LEVEL;
	public static int OFFLINE_NAME_COLOR;
	public static boolean L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
	public static int MANA_POTION_LEVEL;
@@ -1958,6 +1966,15 @@
					L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
					L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));

+          //LEGEND_TITLE = String.valueOf(L2JModSettings.getProperty("LegendTitle"));
+					LEGEND_TITLE_COLOR_RED = Integer.parseInt(L2JModSettings.getProperty("LegendTitleColorRed", "0"));
+					LEGEND_TITLE_COLOR_GREEN = Integer.parseInt(L2JModSettings.getProperty("LegendTitleColorGreen", "0"));
+					LEGEND_TITLE_COLOR_BLUE = Integer.parseInt(L2JModSettings.getProperty("LegendTitleColorBlue", "0"));
+					LEGEND_NAME_COLOR_RED = Integer.parseInt(L2JModSettings.getProperty("LegendNameColorRed", "0"));
+					LEGEND_NAME_COLOR_GREEN = Integer.parseInt(L2JModSettings.getProperty("LegendNameColorGreen", "0"));
+					LEGEND_NAME_COLOR_BLUE = Integer.parseInt(L2JModSettings.getProperty("LegendNameColorBlue", "0"));
+					//LEGEND_VITALITY_LEVEL = Integer.parseInt(L2JModSettings.getProperty("LegendVitalityLevel", "0"));
+
					L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingClan", "False"));
					L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
					L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingFreight", "False"));
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 1475)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -65,6 +65,7 @@
import net.sf.l2j.gameserver.datatables.HennaTable;
import net.sf.l2j.gameserver.datatables.HeroSkillTable;
import net.sf.l2j.gameserver.datatables.ItemTable;
+import net.sf.l2j.gameserver.datatables.LegendSkillTable;
import net.sf.l2j.gameserver.datatables.MapRegionTable;
import net.sf.l2j.gameserver.datatables.NobleSkillTable;
import net.sf.l2j.gameserver.datatables.NpcTable;
@@ -262,8 +263,10 @@

	// Character Character SQL String Definitions:
     private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date,vitality_points,createTime) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
-	private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_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=?,bookmarkslot=?,vitality_points=? WHERE charId=?";
-    private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, 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, 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,bookmarkslot,vitality_points,createTime FROM characters WHERE charId=?";
+	//private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_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=?,bookmarkslot=?,vitality_points=? WHERE charId=?";
+    //private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, 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, 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,bookmarkslot,vitality_points,createTime FROM characters WHERE charId=?";
+	private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_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=?,bookmarkslot=?,vitality_points=?,legend=? WHERE charId=?";
+    private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, 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, 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,bookmarkslot,vitality_points,createTime,legend FROM characters WHERE charId=?";

     // Character Teleport Bookmark:
     private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
@@ -558,6 +561,7 @@

	private boolean _noble = false;
	private boolean _hero = false;
+	private boolean _legend = false;

	/** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
	private L2Npc _lastFolkNpc = null;
@@ -2779,6 +2783,10 @@
		// Add Hero skills if hero
		if (isHero())
			setHero(true);
+			
+		// Add Legend Skills if legend	
+		if (islegend())
+			setlegend(true);

		// Add clan skills 
		if (getClan() != null)
@@ -7701,7 +7709,8 @@
			statement.setLong(51, getDeathPenaltyBuffLevel());
			statement.setInt(52, getBookMarkSlot());
			statement.setInt(53, getVitalityPoints());
-            statement.setInt(54, getObjectId());
+			statement.setInt(54, islegend() ? 1 : 0);
+            statement.setInt(55, getObjectId());

			statement.execute();
			statement.close();
@@ -10136,7 +10145,8 @@
     	_OlympiadStart = b;
     }

-	public boolean isOlympiadStart(){
+	public boolean isOlympiadStart()
+	{
		return _OlympiadStart;
	}

@@ -10144,6 +10154,28 @@
     {
         return _hero;
     }
+    
+    public boolean islegend()
+    {
+    	return _legend;
+    }
+    
+	public void setlegend(boolean legend)
+	{
+		if (legend && _baseClass == _activeClass)
+		{
+			for (L2Skill s : LegendSkillTable.getLegendSkills())
+				addSkill(s, false); //Dont Save Legend skills to database
+		}
+		else
+		{
+			for (L2Skill s : LegendSkillTable.getLegendSkills())
+				super.removeSkill(s); //Just Remove skills from nonLegend characters
+		}
+		_legend = legend;
+		
+		sendSkillList();
+	}

     public boolean isInOlympiadMode()
     {
Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Character.java	(revision 1475)
+++ java/net/sf/l2j/gameserver/model/actor/L2Character.java	(working copy)
@@ -963,6 +963,10 @@
                 if (weaponInst != null)
                     weaponInst.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);

+            if (player.islegend() && target instanceof L2PcInstance)
+            {
+            target.setCurrentCp(0);
+            }

         	if (player != null)
         	{
@@ -971,7 +975,8 @@
                 	// If hitted by a cursed weapon, Cp is reduced to 0
         			if (!target.isInvul())
         				target.setCurrentCp(0);
-        		} else if (player.isHero())
+        		} 
+        		else if (player.isHero())
         		{
         			if (target instanceof L2PcInstance && ((L2PcInstance)target).isCursedWeaponEquipped())
                     	// If a cursed weapon is hitted by a Hero, Cp is reduced to 0
Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(revision 1475)
+++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -338,6 +338,19 @@
			engage(activeChar);
			notifyPartner(activeChar,activeChar.getPartnerId());
		}
+		
+		if (activeChar.islegend())
+		{
+			//activeChar.setTitle(Config.LEGEND_TITLE);
+			activeChar.getAppearance().setTitleColor(Config.LEGEND_TITLE_COLOR_RED, Config.LEGEND_TITLE_COLOR_GREEN, Config.LEGEND_TITLE_COLOR_BLUE);
+			activeChar.getAppearance().setNameColor(Config.LEGEND_NAME_COLOR_RED, Config.LEGEND_NAME_COLOR_GREEN, Config.LEGEND_NAME_COLOR_BLUE);
+			//activeChar.setVitalityLevel(Config.LEGEND_VITALITY_LEVEL);
+			activeChar.sendMessage("You are a Legend!");
+		}
+		else
+		{
+		  activeChar.sendMessage("You are not a Legend.");
+		}

		if (activeChar.isCursedWeaponEquipped()) 
		{

3 answers to this question

Recommended Posts

  • 0
Posted

I created legend colomn on characters table if that is what you mean.

 

And here is LegendSkillTable.java:

/*
* 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.datatables;

import net.sf.l2j.gameserver.model.L2Skill;

/**
*
* @author Stefoulis15
*/
public class LegendSkillTable
{
private static L2Skill[] _legendSkills;

private LegendSkillTable()
{
	_legendSkills = new L2Skill[7];
	_legendSkills[0] = SkillTable.getInstance().getInfo(1218, 230);
	_legendSkills[1] = SkillTable.getInstance().getInfo(1410, 1);
	_legendSkills[2] = SkillTable.getInstance().getInfo(1429, 1);
	_legendSkills[3] = SkillTable.getInstance().getInfo(60, 1);
	_legendSkills[4] = SkillTable.getInstance().getInfo(1374, 1);
	_legendSkills[5] = SkillTable.getInstance().getInfo(1375, 1);
	_legendSkills[6] = SkillTable.getInstance().getInfo(1376, 1);
}

public static LegendSkillTable getInstance()
{
	return SingletonHolder._instance;
}

public static L2Skill[] getLegendSkills()
{
	return _legendSkills;
}

public static boolean isLegendSkill(int skillid)
{
	Integer[] _LegendSkillsId = new Integer[] { 1218, 1410, 1429, 60, 1374, 1375, 1376 };

	for (int id : _LegendSkillsId)
	{
		if (id == skillid)
			return true;
	}

	return false;
}

@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
	protected static final LegendSkillTable _instance = new LegendSkillTable();
}
}

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...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..