Jump to content
  • 0

BOTÃO PARA DELETAR BUFF 1 POR 1


Robert-Downey

Question

ALGUEM PODERIA ME AJUDAR POR UMA OPÇÃO NO NPC BUFFER DE DELETAR OS BUFFS 1 POR 1? 

TEM ALGO SEMELHANTE NOS COMANDOS ADM

 

public static void showMainPage(Player player, Creature creature, int page)

{

// Load static htm.

final NpcHtmlMessage html = new NpcHtmlMessage(0);

html.setFile("data/html/admin/char_effects.htm");

html.replace("%name%", creature.getName());

 

int row = 0;

 

// Generate data.

final Pagination<AbstractEffect> list = new Pagination<>(Arrays.stream(creature.getAllEffects()), page, PAGE_LIMIT_14);

for (AbstractEffect effect : list)

{

list.append(((row % 2) == 0 ? "<table width=280 bgcolor=000000><tr>" : "<table width=280><tr>"));

list.append("<td width=220><a action=\"bypass -h admin_effect remove ", effect.getSkill().getId(), "\">", effect.getSkill().getName(), "</a></td><td width=60>", (effect.getSkill().isToggle()) ? "toggle" : effect.getPeriod() - effect.getTime() + "s", "</td>");

list.append("</tr></table><img src=\"L2UI.SquareGray\" width=280 height=1>");

 

row++;

}

 

list.generateSpace(20);

list.generatePages("bypass admin_effect %page%");

 

html.replace("%content%", list.getContent());

player.sendPacket(html);

}

 

Edited by Robert-Downey

Genius, Billionaire, Playboy, Philanthropist

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Did u try to implement, double click on buff to remove?

Player.java
Add it on the end of the File before the final "}"

	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
		
		// Penalty-like or debuff skill effect can't be dispelled
		// Dance-like skill effect can't be dispelled
		if ((skill == null) || skill.isStayAfterDeath() || skill.isDebuff())
			return;
		
		// Stop skill effect by ID
		_effects.stopSkillEffects(skill.getId());
	}

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
			int id = Integer.parseInt(st.nextToken());
			// Get skill level from second token
			int level = Integer.parseInt(st.nextToken());
			// Dispel skill effect on current character
			player.dispelSkillEffect(id, level);
		}

Like this:image.png.e46002b068992a6f9d558877a6c51b84.png

And add this interface.u to your system, in case you use custom interface, you can compile your own interface.
 



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

and after OnEvent

// 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 ) ) ) ; 
		} 
	} 
}

Credits @Celestine

Chat gpt or other AI's can break tour code. don't use it.

Link to comment
Share on other 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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...



×
×
  • Create New...

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.