Jump to content

[Share]Fame Manager


Recommended Posts

Shot00008-1.jpg

 

Index: net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.java

===================================================================

@@Fame system

 

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=?,fame=?,pvpkills=?,pkkills=?,killingSpree=?,rec_have=?,rec_left=?,clanid=?,maxload=?,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=?,chat_filter_count=?,specialTitle=? 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, fame, pvpkills, pkkills, killingSpree, 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, 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,chat_filter_count,hero,premium,platinum,schemebuffs,specialTitle FROM characters WHERE obj_id=?";

@@

setPvpKills(getPvpKills() + 1);

+  setFame(getFame() + 1);

 

@@

private boolean createDb()

{

java.sql.Connection con = null;

try

{

con = L2DatabaseFactory.getInstance().getConnection();

PreparedStatement statement;

statement = con.prepareStatement("INSERT INTO characters "

+ "(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,"

+ "movement_multiplier,attack_speed_multiplier,colRad,colHeight,"

+ "exp,sp,karma,fame,pvpkills,pkkills,killingSpree,clanid,maxload,race,classid,deletetime,"

+ "cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,"

+ "base_class,newbie,nobless,power_grade,last_recom_date,specialTitle) "

+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

@@

statement.setLong(36, getExp());

statement.setInt(37, getSp());

statement.setInt(38, getKarma());

+ statement.setInt(39, 0);

statement.setInt(40, getPvpKills());

statement.setInt(41, getPkKills());

 

@@

player.setHeading(rset.getInt("heading"));

player.setKarma(rset.getInt("karma"));

+ player.setFame(rset.getInt("fame"));

 

@@

statement.setInt(24, getKarma());

+ statement.setInt(25, getFame());

statement.setInt(26, getPvpKills());

statement.setInt(27, getPkKills());

@@

public void sendMessage(String message)

{

sendPacket(SystemMessage.sendString(message));

}

+ /**

+ *CUSTOM

+ */

+ public int _fame = 0;

+ public void setFame(int fame)

+ {

+ if (fame > Config.MAX_PERSONAL_FAME_POINTS)

+ _fame = Config.MAX_PERSONAL_FAME_POINTS;

+ else

+ _fame = fame;

+ }

+ public int getFame()

+ {

+ return _fame;

+ }

and for table http://i461.photobucket.com/albums/qq331/xaddytzu/asd123.png




 

 

SQL:

INSERT INTO `npc` VALUES ('90011', '31744', 'Ogmar', '1', 'iPlay', '1', 'NPC.a_traderB_MHuman', '8.00', '26.00', '70', 'male', 'L2FameManager', '55', '6666', '6666', '11.00', '11.00', '55', '55', '55', '55', '55', '55', '0', '0', '1314', '1342', '1421', '4123', '1', '0', '0', '0', '0', '0', '0', '0', null, '0', '0', '0', 'LAST_HIT');

 

Index: net.sf.l2j.gameserver.model.actor.instance.L2FameManagerInstance.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.model.actor.instance;
+
+import javolution.text.TextBuilder;
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ai.CtrlIntention;
+import net.sf.l2j.gameserver.serverpackets.ActionFailed;
+import net.sf.l2j.gameserver.serverpackets.MyTargetSelected;
+import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.serverpackets.ValidateLocation;
+import net.sf.l2j.gameserver.templates.L2NpcTemplate;
+
+/**
+ * @author xAddytzu
+ */
+public class L2FameManagerInstance extends L2NpcInstance
+{
+	public L2FameManagerInstance(int objectId, L2NpcTemplate template)
+	{
+		super(objectId, template);
+	}
+	
+	@Override
+	public void onAction(L2PcInstance player)
+	{
+		if (!canTarget(player))
+			return;
+		
+		if (this != player.getTarget())
+		{
+			player.setTarget(this);
+			MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
+			player.sendPacket(my);
+			player.sendPacket(new ValidateLocation(this));
+		}
+		else
+		{
+			if (!canInteract(player))
+				player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
+			else
+				showChatWindow(player);
+		}
+		player.sendPacket(new ActionFailed());
+	}
+	@Override
+	public void showChatWindow(L2PcInstance player, int val) 
+	{
+		NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+		msg.setHtml(rbWindow(player));
+		msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+		player.sendPacket(msg);
+	}
+	private String rbWindow(L2PcInstance player) 
+	{
+		TextBuilder tb = new TextBuilder();
+		tb.append("<html><title>L2 Fame Manager</title><body>");
+		tb.append("<center>");
+		tb.append("<br>");
+		tb.append("<font color=\"999999\">Fame Manager</font><br>");
+		tb.append("<img src=\"L2UI.SquareGray\" width=\"200\" height=\"1\"><br>");
+		tb.append("Welcome "+player.getName()+"<br>");
+		tb.append("<table width=\"85%\"><tr><td>Many of you, asked how to obtain fame points</td></tr></table><br1");
+		tb.append("<table width=\"85%\"><tr><td><font color=\"00FF00\">You must do consecutive pvp kills to be in a killing spree</font></td></tr></table><b1>");
+		tb.append("<table width=\"85%\"><tr><td><font color=\"00FF00\">You can fight in the arena but you earn less points</font></td></tr></table><b1>");
+		tb.append("<img src=\"L2UI.SquareGray\" width=\"280\" height=\"1\"></center><br>");
+
+		tb.append("<a action=\"bypass -h npc_%objectId%_Color_red\">Color Name(Red) ("+Config.FAMECOLORS+ "Fame)</a><br1>");
+		tb.append("<a action=\"bypass -h npc_%objectId%_Color_purple\">Color Name(Purple) ("+Config.FAMECOLORS+ "Fame)</a><br1>");
+		tb.append("<a action=\"bypass -h npc_%objectId%_Color_pink\">Color Name(Pink) ("+Config.FAMECOLORS+ "Fame)</a><br1>");
+		tb.append("<a action=\"bypass -h npc_%objectId%_Color_blue\">Color Name(Blue) ("+Config.FAMECOLORS+ "Fame)</a><br1>");
+		
+		tb.append("<a action=\"bypass -h npc_%objectId%_PK_Count\">Decrease PK count by 1 ("+Config.FAMEPKS+ "Fame)</a><br1>");
+		tb.append("<img src=\"L2UI.SquareGray\" width=\"200\" height=\"1\">");
+
+		tb.append("<center><img src=\"L2UI.SquareGray\" width=\"280\" height=\"1\"></center>");
+		tb.append("</body></html>");
+		return tb.toString();
+	}
+}
@@
Index: net.sf.l2j.gameserver.model.scripts.L2FameManager
===================================================================
+/*
+ * 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.model.scripts;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.serverpackets.UserInfo;
+
+/**
+ * @author xAddytzu
+ *
+ */
+public class L2FameManager
+{
+	public static void PK_Count(L2PcInstance player)
+	{
+		if (player.getFame() >= Config.FAMEPKS && player.getClassId().level() >= 2)
+		{
+			if (player.getPkKills() > 0)
+			{
+				player.setFame(player.getFame() - Config.FAMEPKS);
+				player.setPkKills(player.getPkKills() - 1);
+				player.sendPacket(new UserInfo(player));
+				player.sendMessage("Your PK count was reduced");
+			}
+			else player.sendMessage("You dont have enough PK");
+		}
+		else player.sendMessage("You have not yet met the qualifications");
+	}
+	public static void Red_color(L2PcInstance player)
+	{
+		if (player.getFame() >= Config.FAMECOLORS)
+		{
+			player.setFame(player.getFame() - Config.FAMECOLORS);
+			player.getAppearance().setNameColor(0x0000FF);
+			player.broadcastUserInfo();
+		}
+		else player.sendMessage("You have not yet met the qualifications");
+	}
+	public static void Purple_color(L2PcInstance player)
+	{
+		if (player.getFame() >= Config.FAMECOLORS)
+		{
+			player.setFame(player.getFame() - Config.FAMECOLORS);
+			player.getAppearance().setNameColor(0xFF0080);
+			player.broadcastUserInfo();
+		}
+		else player.sendMessage("You have not yet met the qualifications");
+	}
+	public static void Pink_color(L2PcInstance player)
+	{
+		if (player.getFame() >= Config.FAMECOLORS)
+		{
+			player.setFame(player.getFame() - Config.FAMECOLORS);
+			player.getAppearance().setNameColor(0xFF99FF);
+			player.broadcastUserInfo();
+		}
+		else player.sendMessage("You have not yet met the qualifications");
+	}
+	public static void Blue_color(L2PcInstance player)
+	{
+		if (player.getFame() >= Config.FAMECOLORS)
+		{
+			player.setFame(player.getFame() - Config.FAMECOLORS);
+			player.getAppearance().setNameColor(0xFF8040);
+			player.broadcastUserInfo();
+		}
+		else player.sendMessage("You have not yet met the qualifications");
+	}
+}
@@
Index: net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.java
===================================================================

else if (command.startsWith("ExitRift"))
{
	if(player.isInParty() && player.getParty().isInDimensionalRift())
	{
		player.getParty().getDimensionalRift().manualExitRift(player, this);
	}
	else
	{
		DimensionalRiftManager.getInstance().handleCheat(player, this);
	}
}
+	//Custom
+	else if (command.startsWith("PK_Count"))
+	{
+		L2FameManager.PK_Count(player);
+	}
+	else if (command.startsWith("Color_"))
+	{
+		int endOfId = command.indexOf('_', 5);
+		String id;
+		if (endOfId > 0)
+			id = command.substring(4, endOfId);
+		else
+			id = command.substring(4);
+		try
+		{
+			if (command.substring(endOfId+1).startsWith("red"))
+				L2FameManager.Red_color(player);
+			else if (command.substring(endOfId+1).startsWith("purple"))
+				L2FameManager.Purple_color(player);
+			else if (command.substring(endOfId+1).startsWith("pink"))
+				L2FameManager.Pink_color(player);
+			else if (command.substring(endOfId+1).startsWith("blue"))
+				L2FameManager.Blue_color(player);
+		}
+		catch (NumberFormatException nfe) {}
+	}
@@
Index: net.sf.l2j.Config.java
===================================================================
+    public static int FAMECOLORS;
+    public static int FAMEPKS;
+				FAMECOLORS = Integer.parseInt(otherSettings.getProperty("FameForColors", "1"));
+				FAMEPKS = Integer.parseInt(otherSettings.getProperty("FameForPks", "1"));

Link to comment
Share on other sites

gr: φήμη

alb: famë

rus : слава

jap : 名声

 

Next time you spam, you earn -1.

 

What is the fame ? :O

 

It's a kind of characteristic, awarded by spending time on sieges or so.

Link to comment
Share on other sites

Next time you spam, you earn -1.

 

It's a kind of characteristic, awarded by spending time on sieges or so.

 

I think that you confused him even more :X

On topic : Looks good, i will try it when i have time.

Link to comment
Share on other sites

I think that you confused him even more :X

On topic : Looks good, i will try it when i have time.

 

Well, can't find a better way to explain it..

He can just test it by hiself, by playing..

Link to comment
Share on other sites

WTF same path?

 

Index: net.sf.l2j.gameserver.model.actor.instance.L2FameManagerInstance.java

Index: net.sf.l2j.gameserver.model.actor.instance.L2FameManagerInstance.java

I made this patch manually, thanks for reporting..

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