Jump to content
  • 0

Another Error.


sotid
 Share

Question

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

13 answers to this question

Recommended Posts

  • 0

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");

Link to comment
Share on other sites

  • 0

try to add .toString()

at 

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

 

final

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

Link to comment
Share on other sites

  • 0
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

Link to comment
Share on other sites

  • 0

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

  • 0

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

  • 0

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

  • 0

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

  • 0

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:

 

Link to comment
Share on other sites

  • 0
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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



  • Posts

    • Pinned great guide thanks for this @Trance
    • We'll cover more in the next parts of this series. STABILITY/UPTIME - Linux is more reliable. Windows becomes slow over time, it needs to be rebooted more often than Linux. DRIVERS - Windows drivers are mediocre. Your NIC (Network Interface) will even be taken down if some weird thing happens that it doesn't like.   RESOURCES - how resources can be used and modified through the kernel is at a high level. SECURITY - it can be much safer. FIREWALL/NETWORKING - you can block unwanted traffic, allow desired traffic, redirect packets to alternate TCP/UDP ports, redirect packets to alternate IP addresses, protect against Denial of Service attacks. You can't do most of this on Windows.
    • @TranceThanks for guide this about linux setup. I've a question.. Why should/choose to use linux instead of windows? Linux has a reputation for being fast ok, but what's the real benefits for my server?  
    • its almost same for debian/ubuntu distribution that i use for servers, this is common knowledge for old people.   you must have lots of free time to make all this guides gj, this is actually a basic setup l2j server into linux distribution
    • ✯✯✯✯✯✯✯✯✯✯✯✯ UPDATE ✯✯✯✯✯✯✯✯✯✯✯✯✯✯ REVISION KOREAN 417 - Chosen by Darkness [ Date 20.12.2022 ][ LANG: KR-ORIGINAL ] Clean System Patch Lineage 2 L2exe + Engine.dll unpacked clean 100% [unpacked REVERSECODE-TEAM ] DEVMODE full fixed x3 classic,aden,main [ Kill game guard ][ Kill FROST ] [ Kill AwesomiumProcess ] Sell Clean System [ WTS PM ME ] ✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯✯   REVERSECODE-TEAM creating custom patches for your project unreal scripts , reverse enginering , game client modifications working with protocols 110,140,152,166,196,228,235,245,272,286,306, 311,338,362,388,390,393,395,413,414,415,417,419 if you need some other one, check with us CONTACT ME don't cry it's a game Discord Group >>> https://discord.gg/56EuZyFJj2 <<<       PRICE 70$ + SPECIAL KOREAN REGION prices for each region are different, as well as the order configuration, everything needs to be clarified before ordering, contact us to clarify the details.            
  • Topics

×
×
  • Create New...

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