Jump to content
  • 0

Another Error.


Question

Posted (edited)

My error:

 C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\head-src\com\l2jfrozen\gameserver\model\actor\instance\L2DonateShopInstance.java:928: error: method replace in class NpcHtmlMessage cannot be applied to given types;
    [javac] 					html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
    [javac] 					    ^
    [javac]   required: String,String
    [javac]   found: String,int
    [javac]   reason: actual argument int cannot be converted to String by method invocation conversion
    

 

The actual lines:

case 11:
				String htmContent11 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page4.htm");
				html.setHtml(htmContent11);
				html.replace("%objectId%", String.valueOf(this.getObjectId()));
				html.replace("%charname%", player.getName());
				if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
				{
					html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
				}
				html.replace("%level%", "None");
				player.sendPacket(html);
				break;
			

I know what the error is I see it but I dont know how to fix it. Any help?

Edited by sotid

13 answers to this question

Recommended Posts

  • 0
Posted

Try this one:

ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

 

            if (item != null && item.isAugmented() && item.getAugmentation() != null && item.getAugmentation().getSkill() != null && item.getAugmentation().getSkill().getLevel() >= 1)
                html.replace("%level%", item.getAugmentation().getSkill().getLevel());
            html.replace("%level%", "None");

  • 0
Posted

try to add .toString()

at 

 html.replace("%level%", item.getAugmentation().getSkill().getLevel());

 

final

 html.replace("%level%", item.getAugmentation().getSkill().getLevel().toString());

  • 0
Posted
31 minutes ago, @IcathiaLord said:

Try this one:

ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

 

            if (item != null && item.isAugmented() && item.getAugmentation() != null && item.getAugmentation().getSkill() != null && item.getAugmentation().getSkill().getLevel() >= 1)
                html.replace("%level%", item.getAugmentation().getSkill().getLevel());
            html.replace("%level%", "None"); 

case 11:
				String htmContent11 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page4.htm");
				html.setHtml(htmContent11);
				html.replace("%objectId%", String.valueOf(this.getObjectId()));
				html.replace("%charname%", player.getName());
				ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
				if (item != null && item.isAugmented() && item.getAugmentation() != null && item.getAugmentation().getSkill() != null && item.getAugmentation().getSkill().getLevel() >= 1)
				{
					 html.replace("%level%", item.getAugmentation().getSkill().getLevel());
				}
				html.replace("%level%", "None");
				player.sendPacket(html);
				break;
			

like this?
I get error.

http://prntscr.com/mcj9v3

  • 0
Posted (edited)

Integer.toString(int)

 

Explanation : replace only accepts Strings, not int. Therefore you have to cast your int into a String.

 

aCis NpcHtmlMessage allow to directly use int as parameter, because there are replace for the most used datatypes.

 

	public void replace(String pattern, String value)
	{
		_html = _html.replaceAll(pattern, value.replaceAll("\\$", "\\\\\\$"));
	}
	
	public void replace(String pattern, int value)
	{
		_html = _html.replaceAll(pattern, Integer.toString(value));
	}
	
	public void replace(String pattern, long value)
	{
		_html = _html.replaceAll(pattern, Long.toString(value));
	}
	
	public void replace(String pattern, double value)
	{
		_html = _html.replaceAll(pattern, Double.toString(value));
	}

If you haven't that, you are forced to do it whenever and wherever you need it. Which is extremely redundant, subject to make errors, and increase amount of code.

 

PS : you got your solution on your question, you already have an exemple :

 

html.replace("%objectId%", String.valueOf(this.getObjectId()));

On aCis or wherever clean pack, you would have :

html.replace("%objectId%", getObjectId());
Edited by Tryskell
  • 0
Posted (edited)

ah tryskel is right i confuzed .net with java sorry String.valueOf is the fix :)

about the others just retype the code its encoding issue if you want send me private teamviewer i can retype the code for you and help you solve it 

Edited by DenArt Designs
  • 0
Posted

Sorry, the code i posted was for aCis.

As tryskell said String.valueOf is the solution , so the code must be

html.replace("%level%", String.valueOf(rhand.getAugmentation().getSkill().getLevel()));

  • Like 1
  • 0
Posted (edited)

Thank you all I used this and finally works.

 

html.replace("%level%", Integer.toString(rhand.getAugmentation().getSkill().getLevel()));

 

 

Please dont lock the topic , I will post another error later so I wont spam with topics.

Edited by sotid
  • 0
Posted

Next error as promised. :D
 

Error:

[javac] Compiling 911 source files to C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\build\classes
    [javac] C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\head-src\com\l2jfrozen\gameserver\model\L2Party.java:681: error: cannot find symbol
    [javac] 			member.addItem("Party", itemid, count, player, true);
    [javac] 			                        ^
    [javac]   symbol:   variable itemid
    [javac]   location: class L2Party
    [javac] 1 error

 

Actual lines:

public void distributeAdena(L2PcInstance player, int itemId, long itemCount, L2Character target)
	{
		// Get all the party members
		List<L2PcInstance> membersList = getPartyMembers();

		// Check the number of party members that must be rewarded
		// (The party member must be in range to receive its reward)
		List<L2PcInstance> ToReward = FastList.newInstance();

		for(L2PcInstance member : membersList)
		{
			if(!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true))
			{
				continue;
			}
			ToReward.add(member);
		}

		// Avoid null exceptions, if any
		if (ToReward.isEmpty())
			return;

		// Now we can actually distribute the adena reward
		// (Total adena split by the number of party members that are in range and must be rewarded)
		long count = itemCount / ToReward.size();

		for(L2PcInstance member : ToReward)
		{
			member.addItem("Party", itemid, count, player, true);
		}
		FastList.recycle((FastList<?>) ToReward);
	}

 

I dont get why I get this error , other lines of the same java use itemid before I tried to edit anything.
Anyway the code I used:

 

  • 0
Posted
1 hour ago, DenArt Designs said:

make it itemId not itemid

Thanks , of that was a big oof...

Now what? Do I have to add something in pcinstance?

 

[javac] C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\head-src\com\l2jfrozen\gameserver\model\L2Party.java:680: error: no suitable method found for addItem(String,int,long,L2PcInstance,boolean)
    [javac] 			member.addItem("Party", itemId, count, player, true);
    [javac] 			      ^
    [javac]     method L2PcInstance.addItem(String,int,int,L2Object,boolean) is not applicable
    [javac]       (actual argument long cannot be converted to int by method invocation conversion)
    [javac]     method L2PcInstance.addItem(String,L2ItemInstance,L2Object,boolean) is not applicable
    [javac]       (actual and formal argument lists differ in length)
    [javac] 1 error

 

  • 0
Posted (edited)

Thanks again!

On 1/30/2019 at 1:56 PM, wongerlt said:

try this

member.addItem("Party", itemId , (int) count, player, true);

 

 

Lock it!

Edited by sotid
Guest
This topic is now closed to further replies.
  • Posts

    • You should buy it then I’ll make a discount  
    • Hi everyone,   In 2014, I completely stepped away from developing L2 servers and doing L2J-related work. Since then, I’ve only opened this server about once a year and helped a few servers and individuals for free. I haven’t taken on any paid L2J work since then.   LINEAGE2.GOLD is a project that has reached about Season 6. The first season launched at the end of 2020 and was a fully rebuilt Gold-style server on the Classic client (protocol 110). It featured many custom systems and enhancements. After several seasons, I decided to abandon the Mobius-based project and move to Lucera, as my goal was to get as close as possible to Interlude PTS behavior while still staying on the L2J platform.   The current project was once again completely rebuilt, this time on the Essence client (protocol 306), and is based on Lucera. Because of that, acquiring a license from Deazer is required.   My Lucera extender includes, but is not limited to: Formulas.java Basic anti-bot detection, which proved quite effective, we caught most Adrenaline users using relatively simple server-side logic, logged them, and took staff action. Simple admin account lookup commands based on IP, HWID, and similar identifiers. In-game Captcha via https://lineage2.gold/code, protected by Cloudflare, including admin commands for blacklisting based on aggression levels and whitelisting. Additional admin tools such as Auto-Play status checks, Enchanted Hero Weapon live sync, force add/remove clans from castle sieges, item listeners for live item monitoring, and more. A fully rewritten Auto-Play system with support for ExAutoPlaySetting, while still using the Auto-Play UI wheel, featuring: Debuff Efficiency Party Leader Assist Respectful Hunting Healer AI Target Mode Range Mode Summoner buff support Dwarf mechanics Reworked EffectDispelEffects to restore buffs after Cancellation. Raid Bomb item support. Reworked CronZoneSwitcher. Prime Time Raid Respawn Service. Community Board features such as Top rankings and RB/Epic status. Custom systems for Noblesse, Subclasses, support-class rewards, and much more.   Depending on the deal, the project can include: The lineage2.gold domain The website built on the Laravel PHP framework The server’s Discord Client Interface source Server files and extender source The server database (excluding private data such as emails and passwords)   I’m primarily looking for a serious team to continue the project, as it would be a shame to see this work abandoned. This is not cheap. You can DM me with offers. If you’re wondering why I’m doing this: I’ve felt a clear lack of appreciation from the L2 community, and I’m not interested in doing charity work for people who don’t deserve it. I’m simply not someone who tolerates BS. Server Info: https://lineage2.gold/info Server for test: https://lineage2.gold/download Over 110 videos YouTube playlist: https://www.youtube.com/watch?v=HO7BZaxUv2U&list=PLD9WZ0Nj-zstZaYeWxAxTKbX7ia2M_DUu&index=113
  • Topics

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

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock