Tessa Posted February 2, 2015 Posted February 2, 2015 (edited) 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 February 3, 2015 by Tessa Quote
SweeTs Posted February 2, 2015 Posted February 2, 2015 (edited) _killStage++ and there is no need to check for equipped chaotic weapon and oly. Move it directly under pvp count add. Edited February 2, 2015 by SweeTs Quote
Tryskell Posted February 2, 2015 Posted February 2, 2015 You can _killStage++; instead of setKillStage(getKillStage() + 1); Quote
Tessa Posted February 2, 2015 Author Posted February 2, 2015 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. :) Quote
Admin@Abyssal Posted February 2, 2015 Posted February 2, 2015 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... Quote
Tessa Posted February 2, 2015 Author Posted February 2, 2015 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: Quote
'Baggos' Posted February 2, 2015 Posted February 2, 2015 (edited) 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 February 2, 2015 by 'Baggos' Quote
SweeTs Posted February 2, 2015 Posted February 2, 2015 (edited) 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 February 2, 2015 by SweeTs Quote
Tessa Posted February 2, 2015 Author Posted February 2, 2015 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: Quote
SweeTs Posted February 2, 2015 Posted February 2, 2015 (edited) 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 February 2, 2015 by SweeTs Quote
Tessa Posted February 2, 2015 Author Posted February 2, 2015 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: Quote
SweeTs Posted February 2, 2015 Posted February 2, 2015 (edited) 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 February 2, 2015 by SweeTs Quote
Tessa Posted February 2, 2015 Author Posted February 2, 2015 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 ^_^ Quote
SweeTs Posted February 2, 2015 Posted February 2, 2015 Mmmm, that could be a way, but well. Why to give them the possibility to choose, life is brutal :D Quote
Tessa Posted February 2, 2015 Author Posted February 2, 2015 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 Quote
Recommended Posts
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.