Ir para conteúdo
  • Cadastre-se
  • 0

Java Code 2 lines


AntiVirus

Pergunta

// RequestBypassToServer.java
 
else  if  ( _command. startsWith ( "_dispel" ) ) 

 
    String params = _command. substring ( _command. indexOf ( ":" )  +  1 ) ; 
 
    StringTokenizer st =  new  StringTokenizer ( params, "," ) ; 
 
    int id =  Integer . parseInt ( st.nextToken ( ) ) ;  int level = Integer . parseInt ( st.nextToken ( ) ) ;
    activeChar. dispelSkillEffect ( id, level ) ; }


can someone give me a hand ? 😄 image.png.2427b45df912ca57b73d98d151520425.png i need this code for this interface.u is locked

Editado por AntiVirus
Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts recomendados

  • 0
hace 1 hora, AntiVirus dijo:

// RequestBypassToServer.java
 
else  if  ( _command. startsWith ( "_dispel" ) ) 

 
    String params = _command. substring ( _command. indexOf ( ":" )  +  1 ) ; 
 
    StringTokenizer st =  new  StringTokenizer ( params, "," ) ; 
 
    int id =  Integer . parseInt ( st.nextToken ( ) ) ;  int level = Integer . parseInt ( st.nextToken ( ) ) ;
    activeChar. dispelSkillEffect ( id, level ) ; }


can someone give me a hand ? 😄 image.png.2427b45df912ca57b73d98d151520425.png i need this code for this interface.u is locked

 

To invoke that bypass, you must add that mod to the interface.

fe88ba27bdcc6aac5dc71a887b7aa915.gif

 

Being able to remove UD, Snipe, Stealth or CoV is great, especially in Interlude where these skills don't have a penalty enchant. Many people are already used to canceling Chant of Revenge before pressing Mirage or healing by removing Celestial Shield.

We will need

server sources
interface.u sources with compiler
 

Everything you need is freely available.


The server part

 

The server in our case is ACIS 36x, but any one will do (perhaps PTS). All that is required is to add a command that will remove the specified buff. To keep the example simple, let's get by with a bypass

To remove the buff, more modern clients send a RequestDispel packet , so we'll use the term dispel

First, let's add a dispel method to L2Character. Similar to more recent versions of the game, it will not remove effects that should remain after death (for example, penalties), debuffs, dances and songs:

 

// L2Character.java
 
public  final  void dispelSkillEffect ( int skillId, int skillLevel )  { 
	// Find skill with matching ID and level 
	final L2Skill skill = SkillTable. getInstance ( ) . getInfo ( skillId, skillLevel ) ; 
	// Skill wasn't found and can't be dispelled 
	if  ( skill ==  null ) 
	{ 
		return ; 
	} 
	// Penalty-like or debuff skill effect can't be dispelled 
	if  ( skill.isStayAfterDeath ( )  || skill. isDebuff ( ) ) 
	{ 
		return ; 
	} 
	// Dance-like skill effect can't be dispelled 
	if  ( skill. isDance ( ) ) 
	{ 
		return ; 
	} 
	// Stop skill effect by ID 
	_effects. stopSkillEffects ( skill. getId ( ) ) ; 
}

 

 

Now let's add the bypass handling to the runImpl of the RequestBypassToServer network packet that comes from the client. Since the dispelSkillEffect method requires a skill ID and skill level as arguments, the client must pass them as parameters to the dispel command :

// RequestBypassToServer.java
 
// Usage: _dispel:<int:skill_id>,<int:skill_level> 
// Example: _dispel:313,8 
else  if  ( _command. startsWith ( "_dispel" ) ) 
{ 
	// Cut out command params 
	String params = _command. substring ( _command. indexOf ( ":" )  +  1 ) ; 
	// Split params into tokens 
	StringTokenizer st =  new  StringTokenizer ( params, "," ) ; 
	// Get skill ID from first token 
	intid =  Integer . parseInt ( st.nextToken ( ) ) ; _ // Get skill level from second token int level = Integer . parseInt ( st.nextToken ( ) ) ; _ // Dispel skill effect on current character 
	activeChar. dispelSkillEffect ( id, level ) ; }
	
	 
	

 
Code: Java

Call example: _dispel:313,8 I

recommend making a command with similar parameters instead of bypass. In addition, then players will be able to write macros to remove the buff .

Client-side
cb549700b6c421ddf2b1455f686a37ad.png

 

Unfortunately, there is no easy way to track Alt + Click in the Interlude client, so we use the usual double-click of the left mouse button to remove the buff . The event will be handled by the AbnormalStatusWnd window , which displays the icons of buffs and debuffs
 

Algorithm:

 

We listen in the window AbnormalStatusWnd double click event (OnLButtonDblClick)
Determine the buff that was clicked (via StatusIcon.GetItem)
Determine the ID and skill level of this buff (via GetSkillInfo)
We send a request to the server (via RequestBypassToServer or ExecuteCommand)
We call dispelSkillEffect on the server with the received ID and skill level
 

The double-click event of the left mouse button OnLButtonDblClick receives only the click coordinates as arguments. At the same time, StatusIcon.GetItem requires specifying the row and column of the cell. Accordingly, it is necessary to determine in which row and which column of our buffs the player clicked

 

Since we know that the size of the buff cell is 24 pixels, and the size of the handle for which the window is dragged is 12 pixels, it is easy to calculate the row and cell: it is enough to determine the coordinates of the window with buffs, subtract all values and divide the remainder by the cell size. Values will be rounded correctly when cast to int First, let's add the NSTATUSICON_SIZE

 

constant , which describes the size of the buff cell, to the top of the script. The rest of the developer's constants have already been described:
 

 

// AbnormalStatusWnd.uc
 
class AbnormalStatusWnd extends UIScript ;
 
const NSTATUSICON_FRAMESIZE =  12 ; 
const NSTATUSICON_MAXCOL =  12 ; 
const NSTATUSICON_SIZE =  24 ;
 
// ...

 

 

 

Now, anywhere (for example, immediately after the OnEvent function), add the handling of the double click event:

 

 

// AbnormalStatusWnd.uc
 
function OnLButtonDblClick ( int X ,  int Y )  { 
	local Rect windowBounds ; 
	local int targetRow ; 
	local int targetCol ;
 
	local StatusIconInfo info ; 
	local SkillInfo skillInfo ;
 
	// Find window position 
	windowBounds = Me. GetRect ( ) ;
 
	// Process clicks outside of window frame only 
	if  ( X >  ( windowBounds. nX +  NSTATUSICON_FRAMESIZE ) ) {  // 
		Calc row and col of targeted icon 
		targetRow =  ( Y - windowBounds. nY )  / NSTATUSICON_SIZE ; 
		targetCol =  ( X - windowBounds. nX  - NSTATUSICON_FRAMESIZE )  / NSTATUSICON_SIZE ;
 
		// Store status info of targeted icon 
		StatusIcon. GetItem ( targetRow , targetCol , info ) ;
 
		// Store actual skill info and make sure it is exists 
		if  ( GetSkillInfo ( info. ClassID , info. Level , skillInfo ) )  { 
			// Request server to stop skill effect 
			// Usage: _dispel:<int:skill_id>,<int :skill_level> 
			// Example: _dispel:313,8 
			RequestBypassToServer ( "_dispel:" $ string ( skillInfo. SkillID ) $ "," $ string ( skillInfo. SkillLevel ) ) ) ; 
		} 
	} 
}

 

 

 

Compile interface.u, copy it to the client, run the game

Done!

 

Thanks, to Freelu. (Mxc)

 

 

 

 

 

 

 

 

  • Gostei 2

 

bncwfvf.png

 

 

Link para o comentário
Compartilhar em outros sites


  • 0
3 hours ago, mikado said:

To invoke that bypass, you must add that mod to the interface.

O conteúdo está oculto, favor efetuar login ou se cadastrar!

Being able to remove UD, Snipe, Stealth or CoV is great, especially in Interlude where these skills don't have a penalty enchant. Many people are already used to canceling Chant of Revenge before pressing Mirage or healing by removing Celestial Shield.

We will need

server sources
interface.u sources with compiler
 

Everything you need is freely available.


The server part

The server in our case is ACIS 36x, but any one will do (perhaps PTS). All that is required is to add a command that will remove the specified buff. To keep the example simple, let's get by with a bypass

To remove the buff, more modern clients send a RequestDispel packet , so we'll use the term dispel

First, let's add a dispel method to L2Character. Similar to more recent versions of the game, it will not remove effects that should remain after death (for example, penalties), debuffs, dances and songs:

// L2Character.java
 
public  final  void dispelSkillEffect ( int skillId, int skillLevel )  { 
	// Find skill with matching ID and level 
	final L2Skill skill = SkillTable. getInstance ( ) . getInfo ( skillId, skillLevel ) ; 
	// Skill wasn't found and can't be dispelled 
	if  ( skill ==  null ) 
	{ 
		return ; 
	} 
	// Penalty-like or debuff skill effect can't be dispelled 
	if  ( skill.isStayAfterDeath ( )  || skill. isDebuff ( ) ) 
	{ 
		return ; 
	} 
	// Dance-like skill effect can't be dispelled 
	if  ( skill. isDance ( ) ) 
	{ 
		return ; 
	} 
	// Stop skill effect by ID 
	_effects. stopSkillEffects ( skill. getId ( ) ) ; 
}

Now let's add the bypass handling to the runImpl of the RequestBypassToServer network packet that comes from the client. Since the dispelSkillEffect method requires a skill ID and skill level as arguments, the client must pass them as parameters to the dispel command :

// RequestBypassToServer.java
 
// Usage: _dispel:<int:skill_id>,<int:skill_level> 
// Example: _dispel:313,8 
else  if  ( _command. startsWith ( "_dispel" ) ) 
{ 
	// Cut out command params 
	String params = _command. substring ( _command. indexOf ( ":" )  +  1 ) ; 
	// Split params into tokens 
	StringTokenizer st =  new  StringTokenizer ( params, "," ) ; 
	// Get skill ID from first token 
	intid =  Integer . parseInt ( st.nextToken ( ) ) ; _ // Get skill level from second token int level = Integer . parseInt ( st.nextToken ( ) ) ; _ // Dispel skill effect on current character 
	activeChar. dispelSkillEffect ( id, level ) ; }
	
	 
	

 
Code: Java

Call example: _dispel:313,8 I

recommend making a command with similar parameters instead of bypass. In addition, then players will be able to write macros to remove the buff .

Client-side

O conteúdo está oculto, favor efetuar login ou se cadastrar!

Unfortunately, there is no easy way to track Alt + Click in the Interlude client, so we use the usual double-click of the left mouse button to remove the buff . The event will be handled by the AbnormalStatusWnd window , which displays the icons of buffs and debuffs
 

Algorithm:

We listen in the window AbnormalStatusWnd double click event (OnLButtonDblClick)
Determine the buff that was clicked (via StatusIcon.GetItem)
Determine the ID and skill level of this buff (via GetSkillInfo)
We send a request to the server (via RequestBypassToServer or ExecuteCommand)
We call dispelSkillEffect on the server with the received ID and skill level
 

The double-click event of the left mouse button OnLButtonDblClick receives only the click coordinates as arguments. At the same time, StatusIcon.GetItem requires specifying the row and column of the cell. Accordingly, it is necessary to determine in which row and which column of our buffs the player clicked

Since we know that the size of the buff cell is 24 pixels, and the size of the handle for which the window is dragged is 12 pixels, it is easy to calculate the row and cell: it is enough to determine the coordinates of the window with buffs, subtract all values and divide the remainder by the cell size. Values will be rounded correctly when cast to int First, let's add the NSTATUSICON_SIZE

constant , which describes the size of the buff cell, to the top of the script. The rest of the developer's constants have already been described:
 

// AbnormalStatusWnd.uc
 
class AbnormalStatusWnd extends UIScript ;
 
const NSTATUSICON_FRAMESIZE =  12 ; 
const NSTATUSICON_MAXCOL =  12 ; 
const NSTATUSICON_SIZE =  24 ;
 
// ...

Now, anywhere (for example, immediately after the OnEvent function), add the handling of the double click event:

// AbnormalStatusWnd.uc
 
function OnLButtonDblClick ( int X ,  int Y )  { 
	local Rect windowBounds ; 
	local int targetRow ; 
	local int targetCol ;
 
	local StatusIconInfo info ; 
	local SkillInfo skillInfo ;
 
	// Find window position 
	windowBounds = Me. GetRect ( ) ;
 
	// Process clicks outside of window frame only 
	if  ( X >  ( windowBounds. nX +  NSTATUSICON_FRAMESIZE ) ) {  // 
		Calc row and col of targeted icon 
		targetRow =  ( Y - windowBounds. nY )  / NSTATUSICON_SIZE ; 
		targetCol =  ( X - windowBounds. nX  - NSTATUSICON_FRAMESIZE )  / NSTATUSICON_SIZE ;
 
		// Store status info of targeted icon 
		StatusIcon. GetItem ( targetRow , targetCol , info ) ;
 
		// Store actual skill info and make sure it is exists 
		if  ( GetSkillInfo ( info. ClassID , info. Level , skillInfo ) )  { 
			// Request server to stop skill effect 
			// Usage: _dispel:<int:skill_id>,<int :skill_level> 
			// Example: _dispel:313,8 
			RequestBypassToServer ( "_dispel:" $ string ( skillInfo. SkillID ) $ "," $ string ( skillInfo. SkillLevel ) ) ) ; 
		} 
	} 
}

Compile interface.u, copy it to the client, run the game

Done!

Thanks, to Freelu. (Mxc)

Yeah i find it from MxC. Can you help me modify the code to work like my interface with .dispell ID ONLY 

not like .dispell id,level 

Link para o comentário
Compartilhar em outros sites

  • 0
7 hours ago, mikado said:

To invoke that bypass, you must add that mod to the interface.

O conteúdo está oculto, favor efetuar login ou se cadastrar!

Being able to remove UD, Snipe, Stealth or CoV is great, especially in Interlude where these skills don't have a penalty enchant. Many people are already used to canceling Chant of Revenge before pressing Mirage or healing by removing Celestial Shield.

We will need

server sources
interface.u sources with compiler
 

Everything you need is freely available.


The server part

The server in our case is ACIS 36x, but any one will do (perhaps PTS). All that is required is to add a command that will remove the specified buff. To keep the example simple, let's get by with a bypass

To remove the buff, more modern clients send a RequestDispel packet , so we'll use the term dispel

First, let's add a dispel method to L2Character. Similar to more recent versions of the game, it will not remove effects that should remain after death (for example, penalties), debuffs, dances and songs:

// L2Character.java
 
public  final  void dispelSkillEffect ( int skillId, int skillLevel )  { 
	// Find skill with matching ID and level 
	final L2Skill skill = SkillTable. getInstance ( ) . getInfo ( skillId, skillLevel ) ; 
	// Skill wasn't found and can't be dispelled 
	if  ( skill ==  null ) 
	{ 
		return ; 
	} 
	// Penalty-like or debuff skill effect can't be dispelled 
	if  ( skill.isStayAfterDeath ( )  || skill. isDebuff ( ) ) 
	{ 
		return ; 
	} 
	// Dance-like skill effect can't be dispelled 
	if  ( skill. isDance ( ) ) 
	{ 
		return ; 
	} 
	// Stop skill effect by ID 
	_effects. stopSkillEffects ( skill. getId ( ) ) ; 
}

Now let's add the bypass handling to the runImpl of the RequestBypassToServer network packet that comes from the client. Since the dispelSkillEffect method requires a skill ID and skill level as arguments, the client must pass them as parameters to the dispel command :

// RequestBypassToServer.java
 
// Usage: _dispel:<int:skill_id>,<int:skill_level> 
// Example: _dispel:313,8 
else  if  ( _command. startsWith ( "_dispel" ) ) 
{ 
	// Cut out command params 
	String params = _command. substring ( _command. indexOf ( ":" )  +  1 ) ; 
	// Split params into tokens 
	StringTokenizer st =  new  StringTokenizer ( params, "," ) ; 
	// Get skill ID from first token 
	intid =  Integer . parseInt ( st.nextToken ( ) ) ; _ // Get skill level from second token int level = Integer . parseInt ( st.nextToken ( ) ) ; _ // Dispel skill effect on current character 
	activeChar. dispelSkillEffect ( id, level ) ; }
	
	 
	

 
Code: Java

Call example: _dispel:313,8 I

recommend making a command with similar parameters instead of bypass. In addition, then players will be able to write macros to remove the buff .

Client-side

O conteúdo está oculto, favor efetuar login ou se cadastrar!

Unfortunately, there is no easy way to track Alt + Click in the Interlude client, so we use the usual double-click of the left mouse button to remove the buff . The event will be handled by the AbnormalStatusWnd window , which displays the icons of buffs and debuffs
 

Algorithm:

We listen in the window AbnormalStatusWnd double click event (OnLButtonDblClick)
Determine the buff that was clicked (via StatusIcon.GetItem)
Determine the ID and skill level of this buff (via GetSkillInfo)
We send a request to the server (via RequestBypassToServer or ExecuteCommand)
We call dispelSkillEffect on the server with the received ID and skill level
 

The double-click event of the left mouse button OnLButtonDblClick receives only the click coordinates as arguments. At the same time, StatusIcon.GetItem requires specifying the row and column of the cell. Accordingly, it is necessary to determine in which row and which column of our buffs the player clicked

Since we know that the size of the buff cell is 24 pixels, and the size of the handle for which the window is dragged is 12 pixels, it is easy to calculate the row and cell: it is enough to determine the coordinates of the window with buffs, subtract all values and divide the remainder by the cell size. Values will be rounded correctly when cast to int First, let's add the NSTATUSICON_SIZE

constant , which describes the size of the buff cell, to the top of the script. The rest of the developer's constants have already been described:
 

// AbnormalStatusWnd.uc
 
class AbnormalStatusWnd extends UIScript ;
 
const NSTATUSICON_FRAMESIZE =  12 ; 
const NSTATUSICON_MAXCOL =  12 ; 
const NSTATUSICON_SIZE =  24 ;
 
// ...

Now, anywhere (for example, immediately after the OnEvent function), add the handling of the double click event:

// AbnormalStatusWnd.uc
 
function OnLButtonDblClick ( int X ,  int Y )  { 
	local Rect windowBounds ; 
	local int targetRow ; 
	local int targetCol ;
 
	local StatusIconInfo info ; 
	local SkillInfo skillInfo ;
 
	// Find window position 
	windowBounds = Me. GetRect ( ) ;
 
	// Process clicks outside of window frame only 
	if  ( X >  ( windowBounds. nX +  NSTATUSICON_FRAMESIZE ) ) {  // 
		Calc row and col of targeted icon 
		targetRow =  ( Y - windowBounds. nY )  / NSTATUSICON_SIZE ; 
		targetCol =  ( X - windowBounds. nX  - NSTATUSICON_FRAMESIZE )  / NSTATUSICON_SIZE ;
 
		// Store status info of targeted icon 
		StatusIcon. GetItem ( targetRow , targetCol , info ) ;
 
		// Store actual skill info and make sure it is exists 
		if  ( GetSkillInfo ( info. ClassID , info. Level , skillInfo ) )  { 
			// Request server to stop skill effect 
			// Usage: _dispel:<int:skill_id>,<int :skill_level> 
			// Example: _dispel:313,8 
			RequestBypassToServer ( "_dispel:" $ string ( skillInfo. SkillID ) $ "," $ string ( skillInfo. SkillLevel ) ) ) ; 
		} 
	} 
}

Compile interface.u, copy it to the client, run the game

Done!

Thanks, to Freelu. (Mxc)

 

O conteúdo está oculto, favor efetuar login ou se cadastrar!
  ERROR 404

Link para o comentário
Compartilhar em outros 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.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  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.

Processando...



×
×
  • Criar Novo...

Important Information

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.