Jump to content

Temporary Hero Status On X Kills


Tessa

Recommended Posts

Hello!

 

This thing will give you temporary hero status on X kills (not configurable for now... I can add a config, maybe later). If you die or exit the game - you will lose the hero status.

 

Works on aCis... and all other packs, perhaps (maybe with a small corrections).

 

Just change "2" with any number you want :lol:

if (getKillStage() == 2 && !isHero()) 

Sorry if the code exists around, I didn't found.

Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -171,6 +171,7 @@
 import net.sf.l2j.gameserver.network.serverpackets.ExFishingStart;
 import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode;
 import net.sf.l2j.gameserver.network.serverpackets.ExSetCompassZoneCode;
+import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
 import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
 import net.sf.l2j.gameserver.network.serverpackets.FriendList;
 import net.sf.l2j.gameserver.network.serverpackets.GetOnVehicle;
@@ -392,6 +393,9 @@
 	private byte _siegeState = 0;
 	private int _curWeightPenalty = 0;
 	
+	private int _killStage;
+	private boolean _isHeroByKills = false;
+	
 	private int _lastCompassZone; // the last compass zone update send to the client
 	
 	private boolean _isInWater;
@@ -1442,6 +1446,32 @@
 	}
 	
 	/**
+	 * @return player's current kill stage.
+	 */
+	public int getKillStage()
+	{
+		return _killStage;
+	}
+	
+	/**
+	 * Set the kill stage of the L2PcInstance.
+	 * @param kills int.
+	 */
+	public void setKillStage(int kills)
+	{
+		_killStage = kills;
+	}
+	
+	/**
+	 * Checks if the players is a hero by kills.
+	 * @param hero
+	 */
+	public void setIsHeroByKills(boolean hero)
+	{
+		_isHeroByKills = hero;
+	}
+	
+	/**
 	 * @return The _deleteTimer of the L2PcInstance.
 	 */
 	public long getDeleteTimer()
@@ -4096,6 +4126,16 @@
 		// Icons update in order to get retained buffs list
 		updateEffectIcons();
 		
+		setKillStage(0);
+		
+		if (_isHeroByKills) 
+		{
+			setIsHeroByKills(false);
+			setHero(false);
+			broadcastUserInfo();
+			sendPacket(new ExShowScreenMessage("You lost your hero status!", 3000, 2, true));
+		}
+		
 		return true;
 	}
 	
@@ -4247,6 +4287,19 @@
 			// Send UserInfo packet to attacker with its Karma and PK Counter
 			sendPacket(new UserInfo(this));
 		}
+		
+		if (!isCursedWeaponEquipped() && !isInOlympiadMode())
+		{
+			setKillStage(getKillStage() + 1);
+		}
+		
+		if (getKillStage() == 2 && !isHero())
+		{
+			setIsHeroByKills(true);
+			setHero(true);
+			broadcastUserInfo();
+			sendPacket(new ExShowScreenMessage("Congratulations! You are now a hero by kills.", 3000, 2, true));
+		}
 	}
 	
 	public void updatePvPStatus()

EDIT: Some improvements for this thing (I will keep the old version if someone is interested ^_^)...

 

Some cleanup inspired by SweeTs and Tryskell :lol:

 

Config options are now available.

 

Your kill points will be saved in a column at the characters table (needs SQL update), which means you won't lose your hero status if you exit the game.

 

There are two ways of losing the hero status: If you being registered at Olympiad or die.

 

 

 

Get the improvements from http://pastebin.com/wJr9BQLi

 

Use this query to update the characters table:

ALTER TABLE characters ADD killStage TINYINT UNSIGNED NOT NULL DEFAULT 0;

EDIT: Final version for public ^_^

 

Some methods was renamed according to the good practices.

 

There are one more config option that allows you to choose if you want to save the heroes in the database or not.

Note that the SQL update is a requirement only if you set this to true!

 

Final edition http://pastebin.com/JFrSv4Yb

Edited by Tessa
Link to comment
Share on other sites

_killStage++ and there is no need to check for equipped chaotic weapon and oly. Move it directly under pvp count add.

Edited by SweeTs
Link to comment
Share on other sites

setKillStage++ and there is no need to check for equipped chaotic weapon and oly. Move it directly under pvp count add.

My idea was to count the kill, not if it's a pk or pvp point that is why I put it that way. I just don't want to repeat the code.

 

 

 

You can 

_killStage++;

 instead of 

setKillStage(getKillStage() + 1);

It's cleaner, but I was thinking about something bigger when I created the getters and setters. :)

Link to comment
Share on other sites

and what about if someone is already hero with the same class by olympiad games? :S

 

you can make it from userinfo also charinfo ... just the fake hero effect...

Link to comment
Share on other sites

and what about if someone is already hero with the same class by olympiad games? :S

 

you can make it from userinfo also charinfo ... just the fake hero effect...

Well, this mod works for those who are not a heroes... there are some kind of discrimination but you can add some other goodies for heroes :lol:

Link to comment
Share on other sites

 

Hello!

 

This thing will give you temporary hero status on X kills (not configurable for now... I can add a config, maybe later). If you die or exit the game - you will lose the hero status.

 

Works on aCis... and all other packs, perhaps (maybe with a small corrections).

 

Just change "2" with any number you want :lol:

if (getKillStage() == 2 && !isHero()) 

Sorry if the code exists around, I didn't found.

Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -171,6 +171,7 @@
 import net.sf.l2j.gameserver.network.serverpackets.ExFishingStart;
 import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode;
 import net.sf.l2j.gameserver.network.serverpackets.ExSetCompassZoneCode;
+import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
 import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
 import net.sf.l2j.gameserver.network.serverpackets.FriendList;
 import net.sf.l2j.gameserver.network.serverpackets.GetOnVehicle;
@@ -392,6 +393,9 @@
 	private byte _siegeState = 0;
 	private int _curWeightPenalty = 0;
 	
+	private int _killStage;
+	private boolean _isHeroByKills = false;
+	
 	private int _lastCompassZone; // the last compass zone update send to the client
 	
 	private boolean _isInWater;
@@ -1442,6 +1446,32 @@
 	}
 	
 	/**
+	 * @return player's current kill stage.
+	 */
+	public int getKillStage()
+	{
+		return _killStage;
+	}
+	
+	/**
+	 * Set the kill stage of the L2PcInstance.
+	 * @param kills int.
+	 */
+	public void setKillStage(int kills)
+	{
+		_killStage = kills;
+	}
+	
+	/**
+	 * Checks if the players is a hero by kills.
+	 * @param hero
+	 */
+	public void setIsHeroByKills(boolean hero)
+	{
+		_isHeroByKills = hero;
+	}
+	
+	/**
 	 * @return The _deleteTimer of the L2PcInstance.
 	 */
 	public long getDeleteTimer()
@@ -4096,6 +4126,16 @@
 		// Icons update in order to get retained buffs list
 		updateEffectIcons();
 		
+		setKillStage(0);
+		
+		if (_isHeroByKills) 
+		{
+			setIsHeroByKills(false);
+			setHero(false);
+			broadcastUserInfo();
+			sendPacket(new ExShowScreenMessage("You lost your hero status!", 3000, 2, true));
+		}
+		
 		return true;
 	}
 	
@@ -4247,6 +4287,19 @@
 			// Send UserInfo packet to attacker with its Karma and PK Counter
 			sendPacket(new UserInfo(this));
 		}
+		
+		if (!isCursedWeaponEquipped() && !isInOlympiadMode())
+		{
+			setKillStage(getKillStage() + 1);
+		}
+		
+		if (getKillStage() == 2 && !isHero())
+		{
+			setIsHeroByKills(true);
+			setHero(true);
+			broadcastUserInfo();
+			sendPacket(new ExShowScreenMessage("Congratulations! You are now a hero by kills.", 3000, 2, true));
+		}
 	}
 	
 	public void updatePvPStatus()

EDIT: Some improvements for this thing (I will keep the old version if someone is interested ^_^)...

 

Some cleanup inspired by SweeTs and Tryskell :lol:

 

Config options are now available.

 

Your kill points will be saved in a column at the characters table (needs SQL update), which means you won't lose your hero status if you exit the game.

 

There are two ways of losing the hero status: If you being registered at Olympiad or die.

 

 

 

Get the improvements from http://pastebin.com/wJr9BQLi

 

Use this query to update the characters table:

ALTER TABLE characters ADD killStage TINYINT UNSIGNED NOT NULL DEFAULT 0;

I like this... It's a good idea for a pvp server.

and the shit i create yesterday is good idea but i have wrong on Item. :lol: In 1 hour will be ok.

Edited by 'Baggos'
Link to comment
Share on other sites

If you want to make it kinda advanced. You could make new mothods for hero aura and hero skills, in addition for more kills add hero skills. So, you don't mess anything - heroes ranking for instance :)

 

I have done like that on my sources, so you have more possibilities for the code/methods. But well, why should we share everything.. The same server features everywhere. :)

 

 

Btw

 

 

player.setIsHeroByKills(true);
 
----
 
_isHeroByKills = true;

 

If you know what I mean :happyforever:

Edited by SweeTs
Link to comment
Share on other sites

If you want to make it kinda advanced. You could make new mothods for hero aura and hero skills, in addition for more kills add hero skills. So, you don't mess anything - heroes ranking for instance :)

 

I have done like that on my sources, so you have more possibilities for the code/methods. But well, why should we share everything.. The same server features everywhere. :)

 

 

Btw

player.setIsHeroByKills(true);
 
----
 
_isHeroByKills = true;

If you know what I mean :happyforever:

Yep, I know but actually I prefer the methods instead of properties that is why the cleanup becomes a mess...

This could be a part of something bigger, but I'm currently thinking what exactly to do because this code was written in 5:30 AM and I still can't sleep. :lol:

Link to comment
Share on other sites

Hehehe you lazy ass, I'd make you sleep immediatelly :)

 

 

Well, yes like I/you said, the code "could be a part of something bigger", that's why fake hero would be better, but don't do it :)

 

If you have some nice ideas, let me know. I'm searching something interesting for my project, since I'm empty of good ideas atm :D

Edited by SweeTs
Link to comment
Share on other sites

Hehehe you lazy ass, I'd make you sleep immediatelly :)

 

 

Well, yes like I/you said, the code "could be a part of something bigger", that's why fake hero would be better, but don't do it :)

 

If you have some nice ideas, let me know. I'm searching something interesting for my project, since I'm empty of good ideas atm :D

Separating the aura and skills is a good start... I'm thinking about extending the kills for pvp servers, maybe this can become a currency? :lol:

Link to comment
Share on other sites

Who knows. If you want to extend it, the kills stage, use switch :)

 

 

If you would like to ask something or so, let me know. We can even cooperate* :D

 

 

* - (when I'm not lazy)

Edited by SweeTs
Link to comment
Share on other sites

Who knows. If you want to extend it, the kills stage, use switch :)

 

 

If you would like to ask something or so, let me know. We can even cooperate* :D

 

 

* - (when I'm not lazy)

Sure, we can! :lol:

About the switch I think it could be more fun if the player chooses from a list of rewards... I should try that way ^_^

Link to comment
Share on other sites

Mmmm, that could be a way, but well. Why to give them the possibility to choose, life is brutal :D

It could be brutal for those who can't reach the required points :lol:

Lol, that reminds me about some dualbox/feed restrictions :P

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.



  • Posts

    • Thank you 😊👍 working great! 
    • MidnightSell team WTB/WTS GOLD TWW EU/US all servers Cataclysm all servers Payment Visa/Master/Btc/Eth/Trc-20/Erc-20 (all payments within 10 min) For all question pls dm Discord https://discord.gg/h8AN57qJjK Or Telegram @MidnightSell
    • GOSTEI MUITO DO VIASUAL DO SERVE COMO POSSO ADQUIRI ESSA REV PACK   
    • Helly everyone . I use L2jmobius interlude , i did everything , installed the db compiled the Build in eclipse Gameserver seems to lead OK , but it fails to connect to loginserver When i click to start the loginserver it says  "Loginserver terminated abnormally" This is wheat gameserver shows me :    [05/10 17:25:12] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:12] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:17] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:17] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:22] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:22] LoginServerThread: LoginServer not available, trying to reconnect...   And This is my login config file:   # --------------------------------------------------------------------------- # Login Server Settings # --------------------------------------------------------------------------- # This is the server configuration file. Here you can set up the connection information for your server. # This was written with the assumption that you are behind a router. # Dumbed Down Definitions... # LAN (LOCAL area network) - typically consists of computers connected to the same router as you. # WAN (WIDE area network) - typically consists of computers OUTSIDE of your router (ie. the internet). # x.x.x.x - Format of an IP address. Do not include the x'es into settings. Must be real numbers. # --------------------------------------------------------------------------- # Networking # --------------------------------------------------------------------------- # Bind ip of the LoginServer, use 0.0.0.0 to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 0.0.0.0 LoginserverHostname = 0.0.0.0 # Default: 2106 LoginserverPort = 2106 # The address on which login will listen for GameServers, use * to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 127.0.0.1 LoginHostname = 127.0.0.1 # The port on which login will listen for GameServers # Default: 9014 LoginPort = 9014 # --------------------------------------------------------------------------- # Database # --------------------------------------------------------------------------- # Specify the JDBC driver class for your database. # Default: org.mariadb.jdbc.Driver Driver = org.mariadb.jdbc.Driver # Database URL # Default: jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true URL = jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true # Database user info. Default is "root" but it's not recommended. Login = root # Database user password, leave empty for no password. Password = root # Maximum number of database connections to maintain in the pool. # Default: 5 MaximumDatabaseConnections = 5 # Determine whether database connections should be tested for availability. # Default: False TestDatabaseConnections = False # --------------------------------------------------------------------------- # Automatic Database Backup Settings # --------------------------------------------------------------------------- # Generate database backups when server restarts or shuts down.  BackupDatabase = False # Path to MySQL bin folder. Only necessary on Windows. MySqlBinLocation = C:/xampp/mysql/bin/ # Path where MySQL backups are stored. BackupPath = ../backup/ # Maximum number of days that backups will be kept. # Old files in backup folder will be deleted. # Set to 0 to disable. BackupDays = 30 # --------------------------------------------------------------------------- # Thread Configuration # --------------------------------------------------------------------------- # Defines the number of threads in the scheduled thread pool. # If set to -1, this will be determined by available processors divided by 2. ScheduledThreadPoolSize = 2 # Defines the number of threads in the instant thread pool. # If set to -1, this will be determined by available processors divided by 2. InstantThreadPoolSize = 2 # --------------------------------------------------------------------------- # Security # --------------------------------------------------------------------------- # How many times you can provide an invalid account/pass before the IP gets banned. # Default: 5 LoginTryBeforeBan = 5 # Time you won't be able to login back again after LoginTryBeforeBan tries to login. # Default: 900 (15 minutes) LoginBlockAfterBan = 900 # If set to True any GameServer can register on your login's free slots # Default: True AcceptNewGameServer = True # Flood Protection. All values are in milliseconds. # Default: True EnableFloodProtection = True # Default: 15 FastConnectionLimit = 15 # Default: 700 NormalConnectionTime = 700 # Default: 350 FastConnectionTime = 350 # Default: 50 MaxConnectionPerIP = 50 # --------------------------------------------------------------------------- # Misc Login Settings # --------------------------------------------------------------------------- # If False, the license (after the login) will not be shown. # Default: True ShowLicence = True # Default: True AutoCreateAccounts = True # Datapack root directory. # Defaults to current directory from which the server is started. DatapackRoot = . # --------------------------------------------------------------------------- # Scheduled Login Restart # --------------------------------------------------------------------------- # Enable disable scheduled login restart. # Default: False LoginRestartSchedule = False # Time in hours. # Default: 24 LoginRestartTime = 24    
  • Topics

×
×
  • Create New...