Jump to content
  • 0

[Help]TVT Reward For Kill?


Question

Posted

### Eclipse Workspace Patch 1.0
#P L2_GameServer
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java	(revision 4420)
+++ java/com/l2jserver/Config.java	(working copy)
@@ -667,6 +667,7 @@
	public static TIntIntHashMap TVT_EVENT_FIGHTER_BUFFS;
	public static TIntIntHashMap TVT_EVENT_MAGE_BUFFS;
	public static boolean TVT_ALLOW_VOICED_COMMAND;
+	public static List<int[]> TVT_EVENT_REWARDS_KILL;
	public static boolean L2JMOD_ALLOW_WEDDING;
	public static int L2JMOD_WEDDING_PRICE;
	public static boolean L2JMOD_WEDDING_PUNISH_INFIDELITY;
@@ -2205,6 +2206,7 @@
						else
						{
							TVT_EVENT_REWARDS = new ArrayList<int[]>();
+							TVT_EVENT_REWARDS_KILL = new ArrayList<int[]>();
							TVT_DOORS_IDS_TO_OPEN = new ArrayList<Integer>();
							TVT_DOORS_IDS_TO_CLOSE = new ArrayList<Integer>();
							TVT_EVENT_PARTICIPATION_NPC_COORDINATES = new int[4];
@@ -2278,6 +2280,28 @@
										}
									}

+									//////////////////REWARDS KILLS By Z!T!oN////////////////////
+									propertySplit = L2JModSettings.getProperty("TvTEventRewardKill", "57,2").split(";");
+									for (String reward : propertySplit)
+									{
+										String[] rewardSplit = reward.split(",");
+										if (rewardSplit.length != 2)
+											_log.warning(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventRewardKill \"", reward, "\""));
+										else
+										{
+											try
+											{
+												TVT_EVENT_REWARDS_KILL.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
+											}
+											catch (NumberFormatException nfe)
+											{
+												if (!reward.isEmpty())
+													_log.warning(StringUtil.concat("TvTEventEngine[Config.load()]: invalid config property -> TvTEventRewardKill \"", reward, "\""));
+											}
+										}
+									}
+									//////////////////REWARDS KILLS By Z!T!oN////////////////////
+									
									TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventTargetTeamMembersAllowed", "true"));
									TVT_EVENT_SCROLL_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventScrollsAllowed", "false"));
									TVT_EVENT_POTIONS_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventPotionsAllowed", "false"));
@@ -2362,7 +2386,6 @@
							}
						}
					}
-					
					BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
					BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
					BANKING_SYSTEM_ADENA = Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));
Index: java/com/l2jserver/gameserver/model/entity/TvTEvent.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/TvTEvent.java	(revision 4420)
+++ java/com/l2jserver/gameserver/model/entity/TvTEvent.java	(working copy)
@@ -841,6 +841,42 @@

			CreatureSay cs = new CreatureSay(killerPlayerInstance.getObjectId(), Say2.TELL, killerPlayerInstance.getName(), "I have killed " + killedPlayerInstance.getName() + "!");

+			//////////////////REWARDS KILLS By Z!T!oN////////////////////
+			SystemMessage sysmsg = null;
+			for (int[] reward : Config.TVT_EVENT_REWARDS_KILL)
+			{	
+				if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
+				{
+					killerPlayerInstance.addItem("TvT Kill", reward[0], reward[1], killedPlayerInstance, true);
+					
+					if (reward[1] > 1)
+					{
+						sysmsg = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
+						sysmsg.addItemName(reward[0]);
+						sysmsg.addItemNumber(reward[1]);
+					}
+					else
+					{
+						sysmsg = new SystemMessage(SystemMessageId.EARNED_ITEM);
+						sysmsg.addItemName(reward[0]);
+					}
+					
+					killerPlayerInstance.sendPacket(sysmsg);
+				}
+				else
+				{
+					for (int i = 0; i < reward[1]; ++i)
+					{
+						killerPlayerInstance.addItem("TvT Kill", reward[0], reward[1], killedPlayerInstance, true);
+						sysmsg = new SystemMessage(SystemMessageId.EARNED_ITEM);
+						sysmsg.addItemName(reward[0]);
+						killerPlayerInstance.sendPacket(sysmsg);
+					}
+				}
+			}
+			
+			//////////////////REWARDS KILLS By Z!T!oN////////////////////
+			
			for (L2PcInstance playerInstance : _teams[killerTeamId].getParticipatedPlayers().values())
			{
				if (playerInstance != null)
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 4420)
+++ java/config/l2jmods.properties	(working copy)
@@ -179,6 +179,10 @@
# Example: TvTEventReward = itemId,amount;itemId,amount;itemId,amount
TvTEventReward = 57,100000

+# Reward for kill by Z!T!oN
+# Example: TvTEventRewardKill = itemId,amount;itemId,amount;itemId,amount
+TvTEventRewardKill = 57,2
+
# TvTEvent Rules
TvTEventTargetTeamMembersAllowed = True
TvTEventScrollsAllowed = False

 

Please help or you have new code support l2jserver High Five beta

 

Code error can't add l2jserver hive five beta

 

sysmsg = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);

sysmsg = new SystemMessage(SystemMessageId.EARNED_ITEM);

 

1 answer to this question

Recommended Posts

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