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

    • L2GOLD - Gold x45 C4 Project   C4 - Scions of Destiny: Protocol 656   Fully L2Gold Features - Daily Quest - Daily Mining Quest - Ancient Weapons -Refine System  -Rebirth System -Fully configurable everything you want -Gold stats/Gold skills/Gold items working 100% -Zones 100% alike  -Unique donations system (npc or voicedcommand .donate) - On Enchant success announcement ( if +16 for weapon, 8 for armor , 7 for jewel) - Announce of Castle Lord - Announce of Hero  - Olympiad Max A grade - Olympiad Buffs on matches changed to Gold Alike -Buff shop system on selling buffs with command .buffshop Shift+click dropinfo on mobs. and many more ingame addons.   Server is running a Test Server: Online to anyone can test it.   Game Client: https://www.mediafire.com/file/d0000rmt8ym0323/Lineage_2_C4_Client.rar/file   Game Patch: https://www.mediafire.com/file/39sojdex2mgj55k/L2Gold+Patch+C4.rar/file   GM Accounts: ID: root1 pass root1 [ accounts go from  root1 until root20 ]   Regular Accounts Registrations: http://84.247.164.27/?page=register   Some Screenshots: https://imgur.com/a/KSE4kdq   Contact me here via PM (only serious buyers).    Price of the product: Fully Server Pack + Source ( 200 Euros )
    • Https://lineage2dex.com Discord link : https://discord.com/channels/786506979493281794/814778540893536307/1424434670690504874 ## Dexters! **Our x25 server is celebrating its first week!** 🔥 Online stays strong at peak levels!  New players are joining every day, with 200+ new master accounts registered daily — amazing results! ✨ Tomorrow we launch a new episode along with the first event. Full details will be shared in the morning(October 6). 🎁 And for this little celebration, here’s a bonus code with a small gift for you! ## O05-IIW **Contains: ** * x3 - Training Potion 200% (20 min) * x200 - Mana Potions Loyatly (no weight) *The code will remain active until October 6, 7 AM(server time). And be sure, you have at less 20 slots free on inv before using a code.* **👉 How to redeem:** 1. Log in to your Master Account on site. 2. Click the Redeem Bonus Code button at the top of the panel, type code click redeem. 3. Select the account and character you want to receive the gift.  **Codes work only 1 time for 1 Master Account!** ### Enjoy your adventure, Dexters!
    • Complete Server Pack + Source Files:     C4 Scions Of Destiny: P656 Retail X1 L2OFF Server Pack + Source: Price: 70 EUR   C4 Scions Of Destiny: P656 ESL2 Athena x45 L2OFF Server Pack + Source: Price: 90 EUR Screenshots: https://imgur.com/a/eternal-sin-l2-athena-x45-c4-WYCpbjl   C6 Interlude: P746 ESL2 Athena x45 L2OFF Server Pack + Source: Price: 100EUR The same as C4 but in C6 Client so the Screenshots is the same: https://imgur.com/a/eternal-sin-l2-athena-x45-c4-WYCpbjl     C6 Interlude: P746 L2Gold L2OFF Server Pack + Source: Price: 50EUR Screenshots: https://imgur.com/a/9kB3oA9   C6 - Classic Interlude: P110 ESL2 Athena x45 L2OFF Server Pack + Source: Price: 100EUR Screenshots: https://imgur.com/a/Z2kZxuv   Contact me here via PM (only serious buyers). 
    • Where should I modify the IP to be able to put it online for testing?
    • I had issues with Smart Guard to, there is not even support in many cases.
  • 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