Jump to content

Recommended Posts

Posted

System Configuration options:

#------------------------------------
#-      Custom PvP Reward System       -
#------------------------------------
# INFO: For better system view disable this option:
# EnablePkInfo = False

# Enable Custom Pvp Reward System
CustomPvpRewardEnabled = True

# If the same player to kill, then after X times the reward Will not Increase (0 - Disabled)
CustomPvpRewardProtection = 2

# If the same player to kill, then after X times the reward Will not Increase,
# but it can be reset every Y portion of time (in minutes) from first daily kill (0 - disabled).
# It's reset only daily kills counter.
# Default: 0, Preferred: 1440 [24h].
CustomPvpRewardProtectionReset = 0

# Reward item id
CustomPvpRewardItemId = 6392
# Reward item amount
CustomPvpRewardAmmount = 1

# Minimum player level to obtain reward.
CustomPvpRewardMinLvl = 1

# Gives reward for kill PK player
CustomPvpPkReward = true
#------------------------------------

 

Screenshots:

img1v.png

img2uo.png

img3q.png

 

Patch is easy to implementation, only 4 lines in L2PcInstance, 1 CustomPvpRewardSystem class, 1 sql procedure, 1 sql table, and pvp.properties patch.

 

INFO: This system not ingerate in current pvp reward system. both system can work together, but better turn on one of both.

 

http://www.4shared.com/rar/DIOb4EDv/cprs_10.html

 

SYSTEM CREATED BY matthewmaster04

BIG BIG THANKS TO HIM!!!

Posted

great idea !!!! but i think u was in wrong section br0 but !!! it's a great idea nice work !

Posted

Hi

I did it for Freya l2jserver

 

Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revision 5550)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -264,6 +264,7 @@
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.Point3D;
import com.l2jserver.util.Rnd;
+import com.l2jserver.gameserver.model.actor.instance.PvpRewardSystem;

/**
  * This class represents all player characters in the world.
@@ -5340,7 +5341,11 @@
			L2PcInstance pk = killer.getActingPlayer();

			TvTEvent.onKill(killer, this);
-			
+			if(Config.CUSTOM_PVP_REWARD_ENABLED)
+							{
+								PvpRewardSystem.doCustomPvpReward(pk, this);
+							}
+							
			if (atEvent && pk != null)
			{
				pk.kills.add(getName());
Index: java/com/l2jserver/gameserver/model/actor/instance/PvpRewardSystem.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/PvpRewardSystem.java	(revision 0)
+++ java/com/l2jserver/gameserver/model/actor/instance/PvpRewardSystem.java	(revision 0)
@@ -0,0 +1,180 @@
+/*
+ * 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 com.l2jserver.gameserver.model.actor.instance;
+
+
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.logging.Logger;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.datatables.ItemTable;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.templates.item.L2Item;
+
+import com.l2jserver.L2DatabaseFactory;
+
+
+/**
+ * @author Matthew Mazan
+ *
+ */
+public class PvpRewardSystem {
+	
+	private static Logger _log = Logger.getLogger(PvpRewardSystem.class.getName());
+	
+	/** 
+	 * Executed when kill player (from victim side)
+	 * @param killer
+	 * @param victim
+	 */
+	public static void doCustomPvpReward(L2PcInstance killer, L2PcInstance victim)
+	{
+		//int error_code = 0;
+		int kills = 0;
+		int kills_today = 0;
+		long kill_time = 0;
+		
+		long sys_time = System.currentTimeMillis();
+		long prot_time = (1000 * 60 * Config.CUSTOM_PVP_REWARD_PROTECTION_RESET);
+		
+		Connection con = null;
+		try{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement("CALL CPRS_add(?,?,?,?)"); //query returns updated killer data
+			statement.setInt(1, killer.getObjectId());
+			statement.setInt(2, victim.getObjectId());
+			statement.setLong(3, sys_time);
+			statement.setLong(4, prot_time);
+			
+			ResultSet rset = statement.executeQuery();
+			
+			while(rset.next()){
+				//error_code = rset.getInt("error_code");
+				kills = rset.getInt("kills");
+				kills_today = rset.getInt("kills_today");
+				kill_time = rset.getLong("kill_time");
+				break;
+			}
+			rset.close();
+			statement.close();
+		}catch(SQLException e){
+			e.printStackTrace();
+		}
+		finally{
+			L2DatabaseFactory.close(con);
+		}
+		
+		
+		if(kills_today <= Config.CUSTOM_PVP_REWARD_PROTECTION){
+			if(killer !=null){
+				addItemRewardForKiller(killer, victim);
+			}
+		}else{
+			if((Config.CUSTOM_PVP_PK_REWARD)&&(killer.getKarma() == 0)){
+				if(Config.CUSTOM_PVP_REWARD_PROTECTION > 0){
+					if((Config.CUSTOM_PVP_REWARD_ENABLED)){
+						if(Config.CUSTOM_PVP_REWARD_PROTECTION_RESET == 0){
+							killer.sendMessage("Reward has been awarded for kill this player!");
+						}else{
+							killer.sendMessage("Reward has been awarded for kill this player today!");
+							killer.sendMessage("Next for "+calculateTimeToString(sys_time, kill_time));
+						}
+					}
+				}
+			}
+		}
+
+		
+		
+		if(kills > 1){
+			String timeStr1 = "times";
+			if(kills_today == 1){ timeStr1 = "time"; }
+			String msgVictim1 = killer.getName() + " killed you " + kills + " times.";
+			String msgVictim2 = killer.getName() + " killed you " + kills + " times ( "+ kills_today +" "+timeStr1+" today ).";
+			String msgKiller1 = "You have killed " + victim.getName() + " " + kills + " times.";
+			String msgKiller2 = "You have killed " + killer.getName() + " " + kills + " times ( "+ kills_today +" "+timeStr1+" today ).";
+			
+			if(Config.CUSTOM_PVP_REWARD_PROTECTION_RESET == 0){
+				victim.sendMessage(msgVictim1);
+				killer.sendMessage(msgKiller1);
+			}else{
+				victim.sendMessage(msgVictim2);
+				killer.sendMessage(msgKiller2);
+			}
+		}else{
+			victim.sendMessage("This is the first time you have been killed by " + killer.getName() + ".");
+			killer.sendMessage("You have killed " + victim.getName() + " for the first time."); 
+		}
+
+		killer = null;
+		victim = null;
+		
+	}
+	
+	/**
+	 * Adds the item reward.
+	 *
+	 * @param killer Player who killed.
+	 * @param victim victim Player.
+	 */
+	public static void addItemRewardForKiller(L2PcInstance killer, L2PcInstance victim){	
+		//Anti FARM Reward, level player >= reward_min_lvl
+		if((Config.CUSTOM_PVP_REWARD_MIN_LVL > victim.getLevel())||(Config.CUSTOM_PVP_REWARD_MIN_LVL > killer.getLevel()))
+		{
+			killer.sendMessage("Rewards are awarded on "+ Config.CUSTOM_PVP_REWARD_MIN_LVL + "+ level.");
+		}else{
+	        //IP check
+			if(killer.getClient()!=null)
+			if(killer.getClient().getConnection().getInetAddress() != victim.getClient().getConnection().getInetAddress())
+			{
+	
+				if((killer.getKarma() == 0)&&(killer.getPvpFlag() > 0)||((Config.CUSTOM_PVP_PK_REWARD)&&(killer.getKarma() == 0)&&(victim.getKarma() > 0))){
+					if(Config.CUSTOM_PVP_REWARD_ENABLED)
+					{
+						L2Item reward = ItemTable.getInstance().getTemplate(Config.CUSTOM_PVP_REWARD_ID);
+						
+						//killer.getInventory().addItem("Winning PvP", Config.CUSTOM_PVP_REWARD_ID, Config.PVP_REWARD_A-beep-T, killer, null);
+						killer.addItem("PvP Reward", Config.CUSTOM_PVP_REWARD_ID, Config.PVP_REWARD_A-beep-T, killer, false);
+						killer.sendMessage("You have earned " + Config.PVP_REWARD_A-beep-T + " x " + reward.getName() + ".");
+					}
+				}
+			}else{
+				 victim.sendMessage("Farm is punishable with Ban! Don't kill your Box!");
+		        _log.warning("PVP POINT FARM ATTEMPT: " + victim.getName() + " AND " + killer.getName() +" HAVE SAME IP!");
+			}
+		}
+	}
+	
+	private static String calculateTimeToString(long sys_time, long kill_time){
+		long TimeToRewardInMilli = ((kill_time + (1000 * 60 * Config.CUSTOM_PVP_REWARD_PROTECTION_RESET)) - sys_time);
+        long TimeToRewardHours = TimeToRewardInMilli / (60 * 60 * 1000);
+        long TimeToRewardMinutes = (TimeToRewardInMilli % (60 * 60 * 1000)) / (60 *1000);
+        long TimeToRewardSeconds = (TimeToRewardInMilli % (60 * 1000)) / (1000);
+        
+        String H = Long.toString(TimeToRewardHours);
+        String M = Long.toString(TimeToRewardMinutes);
+        String S = Long.toString(TimeToRewardSeconds);
+        if(TimeToRewardMinutes <= 9){ M = "0" + M; }
+        if(TimeToRewardSeconds <= 9){ S = "0" + S; }
+        
+        return H+":"+M+":"+S;
+	}
+	
+}
+
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java	(revision 5550)
+++ java/com/l2jserver/Config.java	(working copy)
@@ -81,8 +81,10 @@
	public static final String GRANDBOSS_CONFIG_FILE = "./config/Grandboss.properties";
	public static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.properties";
	public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
+


+	
	//--------------------------------------------------
	// L2J Variable Definitions
	//--------------------------------------------------
@@ -725,7 +727,16 @@
	public static int L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
	public static int L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
	public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
+	public static int CUSTOM_PVP_REWARD_PROTECTION_RESET;
+	public static int CUSTOM_PVP_REWARD_PROTECTION;
+	public static boolean CUSTOM_PVP_PK_REWARD;
+	public static boolean CUSTOM_PVP_REWARD_ENABLED;
+	public static int CUSTOM_PVP_REWARD_MIN_LVL;
+	public static int CUSTOM_PVP_REWARD_ID;
+	public static int PVP_REWARD_A-beep-T;

+	
+	
	//--------------------------------------------------
	// NPC Settings
	//--------------------------------------------------
@@ -2246,7 +2257,14 @@

					L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingClan", "False"));
					L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
-					
+					CUSTOM_PVP_REWARD_PROTECTION_RESET = Integer.parseInt(L2JModSettings.getProperty("CustomPvpRewardProtectionReset", "0"));
+					CUSTOM_PVP_REWARD_PROTECTION = Integer.parseInt(L2JModSettings.getProperty("CustomPvpRewardProtection", "2"));
+					CUSTOM_PVP_PK_REWARD = Boolean.parseBoolean(L2JModSettings.getProperty("CustomPvpPkReward", "true"));
+					CUSTOM_PVP_REWARD_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("CustomPvpRewardEnabled", "true"));
+					CUSTOM_PVP_REWARD_MIN_LVL = Integer.parseInt(L2JModSettings.getProperty("CustomPvpRewardMinLvl", "1"));
+					CUSTOM_PVP_REWARD_ID = Integer.parseInt(L2JModSettings.getProperty("CustomPvpRewardItemId", "6392"));
+					PVP_REWARD_A-beep-T = Integer.parseInt(L2JModSettings.getProperty("CustomPvpRewardA-beep-t", "1"));
+
					if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
					{
						TVT_EVENT_ENABLED = false;

 

had a problem here

 

 

if(kills_today <= Config.CUSTOM_PVP_REWARD_PROTECTION){

if(victim.checkAntiFarm(killer)){

addItemRewardForKiller(killer, victim);

}

}else{

if((Config.CUSTOM_PVP_PK_REWARD)&&(killer.getKarma() == 0)){

 

so i changed for

 

if(kills_today <= Config.CUSTOM_PVP_REWARD_PROTECTION){

if(killer !=null){

addItemRewardForKiller(killer, victim);

}

}else{

if((Config.CUSTOM_PVP_PK_REWARD)&&(killer.getKarma() == 0)){

 

in l2pcinstance isnothing about "checkAntiFarm"

Posted

About:

checkAntiFarm(player);

 

This method is in L2jFrozen core. In other projects should exists other methods to check anti farm for players (like same IP, etc).

 

Posted

if(kills_today <= Config.CUSTOM_PVP_REWARD_PROTECTION){

if (AntiFeedManager.getInstance().check(killer, victim)){

addItemRewardForKiller(killer, victim);

}

}else{

 

or maybe am i wrong

Posted

Hello, today i want present new features in my system:

+ Rank Points

+ Player Ranks

 

INFO: All files are in cprs_1.5.rar, in attachment.

It's compatible with L2jFrozen rev.948, for other needed some work, but DB core is universal :D

 

Screen:

50656140049330477517.jpg

 

Config file:

#------------------------------------
#- 	  Custom PvP Reward System	    -
#------------------------------------
# INFO: For better system view disable this option:
# EnablePkInfo = False

# Enable Custom Pvp Reward System
CustomPvpRewardEnabled = False

# If the same player to kill, then after X times the reward Will not Increase (0 - Disabled)
CustomPvpRewardProtection = 0

# If the same player to kill, then after X times the reward Will not Increase, 
# but it can be reset every Y portion of time (in minutes) from first daily kill (0 - disabled).
# It's reset only daily kills counter.
# Default: 1440, Preferred: 1440 [24h].
# INFO: Used in Rank System too.
CustomPvpRewardProtectionReset = 1440

# Reward item id
CustomPvpRewardItemId = 6392
# Reward item amount
CustomPvpRewardAmmount = 1

# Minimum player level to obtain reward.
CustomPvpRewardMinLvl = 1

# Gives reward for kill PK player
CustomPvpPkReward = true

#------------------------------------------------
# Enable Ranks. 								-
#------------------------------------------------
# INFO: CustomPvpRewardEnabled can be disabled.
CustomPvpRankEnabled = false

# Rank names (first element is the best):
# Format: name1,name2,name3
# Example: CustomPvpRankName = God finger,Mass killer,Killer,No Rank
CustomPvpRankName = Rank 1,Rank 2,Rank3

# INFO: Be careful with points. MySql database allow DECIMAL(20) total rank_points.

# Rank require points (first element is points count for obtain 1st rank title, in example: God finger):
# Format: count1,count2,count3
# (count1 > count2 > count3) > 0
# Example: CustomPvpRankMinPoints = 10000,1000,400,1
# IMPORTANT: property elements count must be same like in CustomPvpRankName.
CustomPvpRankMinPoints = 300,100,50

# Example: For God finger kills reward is 100 points.
# Format: count1,count2,count3
# IMPORTANT: properties count must be same like in CustomPvpRankName.
CustomPvpRankPointsForKill = 100,30,15

# If the same player to kill, then after X times the points will not increase (0 - Disabled).
# If CustomPvpRankFarmProtect = 3, then it return 0 Rank Points for kill 4 time the same player.
CustomPvpRankFarmProtect = 0

# Enable other points counting for players.
# If enabled CustomPvpRankPointsForKill is ignored.
# Example: CustomPvpRankKillPointsDown = 100,50,10,1,0
# For first daily kill awards 100, 2nd kill give 50, ... , 0.
CustomPvpRankKillPointsDownEnabled = false
CustomPvpRankKillPointsDown = 100,50,10,1,0

# Shout current Points info to killer & victim.
CustomPvpRankShoutInfo = true

# Enable Rank Points for kill innocent players. (PK mode ON)
CustomPvpRankAwardPK = false

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

 

PS. Thx for using ;)

 

PS. Sorry for english in code but i am from poland :D

 

Download:

http://www64.zippyshare.com/v/72548404/file.html

 

http://www.4shared.com/rar/-TWIDSTU/cprs_15.html

 

Posted

Fixed: wrong victim name in info message.

Added: Minimum players level option for obtain Rank Points.

 

Links:

http://www.4shared.com/rar/ncjH-m92/cprs_16.html

http://www5.zippyshare.com/v/60558512/file.html

 

Guest
This topic is now closed to further replies.



  • Posts

    • Продам комплекты (Custom Colour) Apella Сеты. Контакт со мной/Contact with me  Telegram. Custom Colour Apella Light YouTube Video
    • haha, I don't say it, chatgpt says it. discuss it with him if you have problems 😉 or sue chatgpt for lying, for example when he tells you that you are an idiot and tells you that I do things that are light years ahead of you.
    • hey i make enough to live comfortably you, on the other hand... doubt that'd be the case if you were as competent as you claim to be
    • all your doubts ask chatgpt, also ask what you could do yourself hahaha
    • This post originally appeared on MmoGah. Odin: Valhalla Rising is an ambitious open-world MMORPG developed with Unreal Engine 4, offering breathtaking visuals and immersive gameplay. I will share everything you need to know before starting it.     Re-rolling In Odin, re-rolling isn't a practical strategy. Unlike most gacha games, where it's common to reset for better initial pulls, Odin focuses heavily on long-term growth. The earlier you begin playing and developing your character, the more advantages you'll gain over time. Instead of spending your efforts on re-rolling for ideal equipment, it's better to dive in and start progressing right away.   Server Selection Before starting your character, selecting a server is a crucial step. Since Odin doesn't support cross-server gameplay, coordinating with your friends, family, or guildmates is essential to ensure everyone creates their characters on the same server. Take the time to plan with your group beforehand. After deciding on a server, your next major choice will be picking a class.   Class Breakdown Odin features four primary starting classes: Warrior, Sorceress, Rogue, and Priest. Each class comes with its own distinct playstyle and unique strengths, so choose wisely, as your selection is permanent. However, even free-to-play players can create up to three characters on one server, giving you the flexibility to try different options and find the one that matches your preferences.   Quest and Leveling Once your character is created, your initial objective is to work through the main questline. This acts as both a tutorial and a method for early leveling. Odin simplifies the process with a convenient quest button that handles navigation, starts dialogues, and even enables auto-combat. This user-friendly feature allows beginners to grasp the basics of the game without feeling overloaded.   Auto Combat and No Kill-steal Mode Auto combat is an essential feature in Odin, enabling your character to battle monsters autonomously. This system allows you to effortlessly gain experience and loot, even while you're busy studying, cooking, or unwinding. To optimize its use, activate the no-kill-steal mode. This setting prevents your character from targeting monsters already engaged by other players, helping you avoid conflicts or potential PvP situations. However, if a quest becomes difficult to complete due to overcrowded areas, you can temporarily disable this mode to overcome the obstacle and move forward.   Item Management and Potions Don't overlook the importance of consumable items, especially health potions. These can be purchased, along with buffs, from general merchants in villages, and they play a crucial role in improving your combat efficiency and ensuring your survival. Always aim to keep a full stock of HP potions and carry buffs that boost attack, defense, or regeneration in batches of 5-10 for convenience.   Once you've acquired your consumables, assign them to your quick slots located at the bottom center of the screen. Swiping down activates these slots, and items like potions will automatically be used when necessary, so you don't need to worry about them mid-battle. Keep a close eye on your potion reserves, as running out during a tough fight could leave you vulnerable before reaching a safe area. In the early stages of the game, it's better to return to town for a restock if supplies are low rather than risking unnecessary defeats. You can also enable notifications to alert you when your health or potion count drops too low—a handy feature for staying prepared if your attention is elsewhere.   Leveling and AFK Farming Once you've mastered the fundamentals, the next step is to focus on leveling up and enhancing your character. Gaining levels is your primary source of progression early on, as it not only improves your stats but also unlocks crucial game features and new abilities. At this stage, simply sticking to the main questline provides a reliable and efficient way to gain experience.   Additionally, Odin includes a highly convenient idle feature called AFK mode. This allows your character to keep farming for resources and experience even when the game is closed, with a maximum duration of 8 hours per day. It's an excellent option for making progress while you're asleep, commuting, or otherwise occupied.   Gear Upgrades When the time comes to improve your gear, the initial focus should be on upgrading from normal-grade equipment to high-grade items. These provide significantly better stats and can be enhanced further to increase their effectiveness. Enhancing requires enhancement stones and gold, but it's important to stay within the safe enhancement limit. Attempting upgrades beyond this limit carries the risk of destroying your gear if the enhancement fails. Stick to safe enhancements until you've gained more experience and accumulated spare equipment to mitigate potential losses.   Skill Purchases When you've accumulated enough gold, it's time to invest in skills. These are crucial for enhancing your combat abilities and provide key benefits tailored to your class, whether it's increasing damage output, improving healing capabilities, or adding valuable utility. Before purchasing, ensure your character meets the level prerequisites for each skill. Your ultimate goal will be progressing through and completing the main questline in Midgard as you continue to develop your character.   Unlocking Jotenheim Finishing this milestone grants you access to the next region, Jetunheim, unlocking a variety of new content and challenges. This marks your first significant achievement in the game and is an essential early objective to strive for as you progress.   Joining a Guild Joining a guild is a highly beneficial step in Odin. Guilds not only provide opportunities for social interaction and group activities but also offer passive bonuses that can significantly enhance your gameplay. Even if you're not particularly active socially, being part of any guild is advantageous. The guild feature becomes accessible after completing Chapter 4, Quest 19 of the main story.   Guilds provide various perks, including buffs that scale with the guild's level. Additionally, you can earn guild coins by contributing through donations, quest completions, or regular logins. These coins can be exchanged for valuable rewards, such as epic-grade armor. The more you actively contribute to your guild, the greater the overall benefits for both you and the guild itself. Joining early and staying involved will undoubtedly strengthen your progression in the game.   Conclusion Here is the end of this beginners' guide. I hope these tips will help you level fast in Odin.
  • Topics

×
×
  • Create New...