[HELP] adena dissapear after relog

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

[HELP] adena dissapear after relog

Post by xrs »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:3587M
L2JDP Revision Number:6680

I'm building a faction type server.
When a player kills other faction player he gets a reward exp + adena.
With exp it's all OK. But when I give adena to player, they aper in his inventory only untill he relogs.
After character relogin his adena is back to 0.
I add adena to players inventory with:
addItem("Loot", 57, AdenaReward, this, true);
It seems that addItem is not saving data to database.

Any ideas? :shock:
User avatar
Copyleft
Posts: 253
Joined: Fri Feb 01, 2008 9:39 pm

Re: [HELP] adena dissapear after relog

Post by Copyleft »

I think you'll need to send an inventory update packet... not sure
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: [HELP] adena dissapear after relog

Post by xrs »

Come on guys, geve me some help :)
I'm out of ideas what is wrong. I've searched for examples, but everywhere and everyone does that the same way.
addItem() or addAdena().
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: [HELP] adena dissapear after relog

Post by xrs »

What I'm trying to do now is this:

L2PcInstance player = getActingPlayer();
InventoryUpdate iu = new InventoryUpdate();
L2ItemInstance money = player.getInventory().addItem("Loot", 57, nvcAdenaReward, this, true);
iu.addModifiedItem(money);
player.sendPacket(iu);

And when I try to compile I get error:

cannot find symbol [javac] symbol : method addItem(java.lang.String,int,int,net.sf.l2j.gameserver.model.actor.instance.L2PcInstance,boolean)
[javac] location: class net.sf.l2j.gameserver.model.itemcontainer.PcInventory
[javac] L2ItemInstance money = getInventory().addItem("Loot", 57, nvcAdenaReward, this, true);
^
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: [HELP] adena dissapear after relog

Post by JIV »

invetory update is only junk for client, screw it..
use

Code: Select all

public void addAdena(String process, long count, L2Object reference, boolean sendMessage)
ex:

Code: Select all

player.addAdena("X", 1000, null, false);
addAdena will do inv update for you...
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: [HELP] adena dissapear after relog

Post by xrs »

JIV wrote:invetory update is only junk for client, screw it..
use

Code: Select all

public void addAdena(String process, long count, L2Object reference, boolean sendMessage)
ex:

Code: Select all

player.addAdena("X", 1000, null, false);
addAdena will do inv update for you...
The problem that I allready tryed that. addAdena and addItem works prity much the same way.
addAdena adds adenas to inventory, but it doesnt save anything to database. Client gets info that he reveided adenas, and in inventory I can see them, but it's only info that client has. After char relogin, adena is equal to 0 again. Server running in debug mode and no errors. Just simply it doesn't save anything to database. Server by itself is not meesed up or something like that. If I buy something from shop, items stays even after relogin.

This addAdena is used in L2PcInstance.java if that changes anything.
exact code that I'm trying rigth now:
L2PcInstance player = getActingPlayer();
player.addAdena("Loot", AdenaReward, null, false);

And no luck...
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: [HELP] adena dissapear after relog

Post by JIV »

dont use "Loot" try something different.
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: [HELP] adena dissapear after relog

Post by xrs »

Now I'm really confused...
If I add 1 adena to players inventory. It actually apears in database (items table). But if add 1 more adena to that char or I relogin, adenas dissapear from database. I gues this is some kind of server/client miscomunication.
User avatar
Gnacik
L2j Veteran
L2j Veteran
Posts: 925
Joined: Tue Dec 16, 2008 3:49 pm
Location: Wąchock ٩(̾●̮̮̃̾•̃̾)۶ Polska
Contact:

Re: [HELP] adena dissapear after relog

Post by Gnacik »

Small amounts of adena are not saved always. Try to add higher values of Adena ;=P
ItemContainer.java

Code: Select all

// Updates databaseif (itemId == 57 && count < 10000 * Config.RATE_DROP_ADENA){	// Small adena changes won't be saved to database all the time	if (GameTimeController.getGameTicks() % 5 == 0)		item.updateDatabase();}else	item.updateDatabase();
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: [HELP] adena dissapear after relog

Post by xrs »

Gnacik wrote:Small amounts of adena are not saved always. Try to add higher values of Adena ;=P
ItemContainer.java

Code: Select all

// Updates databaseif (itemId == 57 && count < 10000 * Config.RATE_DROP_ADENA){	// Small adena changes won't be saved to database all the time	if (GameTimeController.getGameTicks() % 5 == 0)		item.updateDatabase();}else	item.updateDatabase();
I allready modifyed this part of code, that it would save the data regardless of adeana amount. Thats not what's causing this problem.
Last edited by xrs on Fri Oct 02, 2009 10:58 am, edited 1 time in total.
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: [HELP] adena dissapear after relog

Post by xrs »

JIV wrote:dont use "Loot" try something different.
Tryed xxx instead of Loot, but no luck :/
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: [HELP] adena dissapear after relog

Post by xrs »

Problem solved:
L2PcInstance player = getActingPlayer();
player.addAdena("xxx", AdenaReward, player, true);
Post Reply