Jump to content
Sign in to follow this  
TeodosTv

Code Custom Sound PvP - L2jFrozen

Recommended Posts

### Eclipse Workspace Patch 1.0

#P L2jFrozen_GameServer

Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java

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

--- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 573)

+++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)

@@ -648,6 +648,10 @@

public String _teamNameTvT, _originalTitleTvT;

public int _originalNameColorTvT = 0, _countTvTkills, _countTvTdies, _originalKarmaTvT;

public boolean _inEventTvT = false;



/** CTF Engine parameters */

public String _teamNameCTF,

@@ -666,7 +670,6 @@

_countDMkills,

_originalKarmaDM;

public boolean _inEventDM = false;



public int _correctWord = -1;

public boolean _stopKickBotTask = false;



@@ -900,7 +903,18 @@

private final BlockList _blockList = new BlockList();



private int _team = 0;



/**

* lvl of alliance with ketra orcs or varka silenos, used in quests and aggro checks [-5,-1] varka, 0 neutral, [1,5]

* ketra

@@ -5632,6 +5646,8 @@

// Kill the L2PcInstance

if(!super.doDie(killer))

return false;

+

+ spreeKills = 0;



Castle castle = null;

if(getClan() != null)

@@ -5834,6 +5850,22 @@

boolean isKillerPc = killer instanceof L2PcInstance;

if(isKillerPc && ((L2PcInstance) killer).getClan() != null && getClan() != null && !isAcademyMember() && !((L2PcInstance) killer).isAcademyMember() && _clan.isAtWarWith(((L2PcInstance) killer).getClanId()) && ((L2PcInstance) killer).getClan().isAtWarWith(_clan.getClanId()))

{

+ PlaySound _snd = new PlaySound(1, "enemydown", 0, 0, 0, 0, 0);

+

+ Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();

+ for (L2PcInstance onlinePlayer : pls)

+ if (onlinePlayer.isOnline() == 1)

+ {

+ if (onlinePlayer.getClan() != null)

+ {

+ if (onlinePlayer.getClan() == pk.getClan() && onlinePlayer != pk)

+ {

+ onlinePlayer.sendPacket(_snd);

+ }

+ }

+ }

+

+

if(getClan().getReputationScore() > 0)

{

((L2PcInstance) killer).getClan().setReputationScore(((L2PcInstance) killer).getClan().getReputationScore() + 2, true);

@@ -6109,11 +6141,12 @@

{

// check about wars

if(targetPlayer.getClan() != null && getClan() != null)

- {

+ {

if(getClan().isAtWarWith(targetPlayer.getClanId()))

{

if(targetPlayer.getClan().isAtWarWith(getClanId()))

- {

+ {

+

// 'Both way war' -> 'PvP Kill'

increasePvpKills();

if(target instanceof L2PcInstance && Config.ANNOUNCE_PVP_KILL)

@@ -6296,8 +6329,51 @@

/**

* Increase the pvp kills count and send the info to the player

*/

+ private int spreeKills = 0;

public void increasePvpKills()

{

+ spreeKills++;

+

+ switch(spreeKills){

+

+ case 1:

+ PlaySound _snd1 = new PlaySound(1, "firstblood", 0, 0, 0, 0, 0);

+ sendPacket(_snd1);

+ break;

+

+ case 2:

+ PlaySound _snd2 = new PlaySound(1, "doublekill", 0, 0, 0, 0, 0);

+ sendPacket(_snd2);

+ break;

+

+ case 3:

+ PlaySound _snd3 = new PlaySound(1, "triplekill", 0, 0, 0, 0, 0);

+ sendPacket(_snd3);

+ break;

+

+ case 4:

+ PlaySound _snd4 = new PlaySound(1, "megakill", 0, 0, 0, 0, 0);

+ sendPacket(_snd4);

+ break;

+

+ case 5:

+ PlaySound _snd5 = new PlaySound(1, "ultrakill", 0, 0, 0, 0, 0);

+ sendPacket(_snd5);

+ break;

+

+ case 10:

+ PlaySound _snd10 = new PlaySound(1, "monsterkill", 0, 0, 0, 0, 0);

+ sendPacket(_snd10);

+ break;

+

+ case 15:

+ PlaySound _snd15 = new PlaySound(1, "killingspree", 0, 0, 0, 0, 0);

+ sendPacket(_snd15);

+ break;

+ default:

+ ;

+ }

+

int x,y,z;

x = getX();

y = getY();

@@ -6658,6 +6734,10 @@

{

newKarma = Integer.MAX_VALUE - getKarma();

}

+ PlaySound _snd = new PlaySound(1, "knife", 0, 0, 0, 0, 0);

+ sendPacket(_snd);

+ broadcastPacket(_snd);

+



// Add karma to attacker and increase its PK counter

int x,y,

 

Share this post


Link to post
Share on other sites

I don't think there is anyone playing with sound [ON].
If someone good is playing with his clan, he is using Teamspeak ( or w/e ) and has the sound [OFF].
If anyone else is playing, he is listening some good shit gangsta music.

Share this post


Link to post
Share on other sites
10 minutes ago, TeodosTv said:

Its Only PvPSounds Like DoubleKill , TripleKill , Rampage

 

I will help some peoples looking something like this!

 

:) :D :) :D

at least is something new, good.

  • Like 1

Share this post


Link to post
Share on other sites

Dear god this coding... Use enums better... 

 

public enum Spree
	{
		DOUBLE_KILL(2, "Double Kill"),
		TRIPLE_KILL(3, "Triple Kill"),
		ULTRA_KILL(4, "Ultra Kill");
		
		final int kill;
		final String msg;
		
		private Spree(final int kill, final String msg)
		{
			this.kill = kill;
			this.msg = msg;
		}
		
		public void triggerBroadcast(final L2PcInstance player)
		{
			player.setSpreeKills(player.getSpreeKills() + 1);
			
			for (Spree s : Spree.values())
			{
				if (s.kill == player.getSpreeKills())
				{
					Broadcast.announceToOnlinePlayers("Player " + player.getName() + " got a " + s.msg);
				}
			}
		}
	}

Took me 45 seconds and is 2000% better than 450 lines of code you did...

Edited by Evie Frye
  • Like 1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.



×