Page 1 of 1

[HELP] adena dissapear after relog

Posted: Thu Oct 01, 2009 1:53 pm
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:

Re: [HELP] adena dissapear after relog

Posted: Thu Oct 01, 2009 3:14 pm
by Copyleft
I think you'll need to send an inventory update packet... not sure

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 7:36 am
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().

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 9:24 am
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);
^

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 9:34 am
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...

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 10:23 am
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...

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 10:42 am
by JIV
dont use "Loot" try something different.

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 10:45 am
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.

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 10:46 am
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();

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 10:50 am
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.

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 10:57 am
by xrs
JIV wrote:dont use "Loot" try something different.
Tryed xxx instead of Loot, but no luck :/

Re: [HELP] adena dissapear after relog

Posted: Fri Oct 02, 2009 12:11 pm
by xrs
Problem solved:
L2PcInstance player = getActingPlayer();
player.addAdena("xxx", AdenaReward, player, true);