TFS 1.X+ Anty-Stack Runes - minCount, maxCount in Items.xml attribute?

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
Hello there!
I have a problem with making that runes on TFS 1.X+ not stackable.
I done everything with adding in sources near all functions that can stack runes simple: !item->isRune() but Im stuck at one thing.
If player already got ex. 5 runes in EQ (EQ means slots not backpack) and trying to make more rune, the rune that player is going to make instantly dissapear.
I think I should fix that by putting attribute minCount, maxCount in items.xml or something like that but i have no clue how to add this.

Anyone who got huge knowledge about sources (C++) can help me with that request?
I will be very glad if you can do something about that and share part of codes or something.

Thanks in advance,
Fresh.
 

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
So you want they to be not stackable, but possible to create with some count (like GFB x5)?
If you leave them 'stackable' in Tibia.dat client will still show 'select count' window wheny you drag and drop rune.
If you set them 'not stackable' in Tibia.dat client won't show their count and probably it will crash, because of invalid game protocol (client expects server to not send count of items not stackable).

To make it work like this, you need old tibia client (up to 8.54 as I remember), which had option 'rune' in .dat = show count of item in backpack (of item that is not stackable).

In case you got proper client you need to change:

1. make item not stackable when add to slot, tell server that it needs to replace (exchange places) item to add it to that slot:
otland/forgottenserver

2. return 'stack empty space = 0' (maxQueryCount) when add to slot with item in this slot, default is '100 - items alreade in slot':
otland/forgottenserver
 

ckripz

Member
Joined
May 30, 2013
Messages
59
Best answers
0
Reaction score
6
I like the idea, hopefully someone can help you.
 
OP
Fresh

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
So you want they to be not stackable, but possible to create with some count (like GFB x5)?
If you leave them 'stackable' in Tibia.dat client will still show 'select count' window wheny you drag and drop rune.
If you set them 'not stackable' in Tibia.dat client won't show their count and probably it will crash, because of invalid game protocol (client expects server to not send count of items not stackable).

To make it work like this, you need old tibia client (up to 8.54 as I remember), which had option 'rune' in .dat = show count of item in backpack (of item that is not stackable).

In case you got proper client you need to change:

1. make item not stackable when add to slot, tell server that it needs to replace (exchange places) item to add it to that slot:
otland/forgottenserver

2. return 'stack empty space = 0' (maxQueryCount) when add to slot with item in this slot, default is '100 - items alreade in slot':
otland/forgottenserver

Sended you PM, please read :( :D
 
OP
Fresh

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
I have done everything with stacks done in C++ with using item->isRune() attribute and stacking is poorly done without any errors but last error stayed in.

For example what last error i have:
What is should be like without errors:


And this error only occured when player got ex. HMM in hand and trying to convince one more rune in backpack / whatever.
When player got both hands and arrow slot equipped with items and trying to convince runes in backpack (got blank runes in backpack) everything is working good.

The problem is only when player already got HMM rune in hands/arrow slot.
 

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
Did you modify these parts of code:
1. make item not stackable when add to slot, tell server that it needs to replace (exchange places) item to add it to that slot:
otland/forgottenserver

2. return 'stack empty space = 0' (maxQueryCount) when add to slot with item in this slot, default is '100 - items alreade in slot':
otland/forgottenserver
They are responsible for 'trying' to stack runes.
So if you blocked 'real stack' (addThing), but left 'is stack possbile' (queryDestination, queryAdd, queryMaxCount) it thinks it can stack item.

In case of 'create rune function', you need to debug simple 'player:addItem(2293, 3)':
otland/forgottenserver
Which executes:
otland/forgottenserver
which executes ('toCylinder' = player):
queryDestination
queryAdd

I'm 99% sure that your 'queryDestination' returns already existing HMM rune as 'itemTo' and then it tries to add item to it (stack).

Probably you just need to add '&& !item->isRune()' to:
otland/forgottenserver
 
OP
Fresh

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
I fixed the bug with not conjuring runes properly
but last bug that i have is in INVENTORY window

When player got rune and trying to move on different rune it overwrite the rune that player is moving on

and the
Probably you just need to add '&& !item->isRune()' to:
otland/forgottenserver
Won't fixed that problem i checked it now and zero fix :p
 
OP
Fresh

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
And i tested it and it's only overwrite the rune with the same ID , ex -> HMM overwrite HMM's and SD's not overwrite HMM's , etc.
 

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
I fixed the bug with not conjuring runes properly
but last bug that i have is in INVENTORY window

When player got rune and trying to move on different rune it overwrite the rune that player is moving on

and the

Won't fixed that problem i checked it now and zero fix :p
Check this:
otland/forgottenserver
otland/forgottenserver
It should be responsible for 'stacking' items when you drop item X on other item with same itemid in container.
 
OP
Fresh

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
Fixed ALL. // close thread plz.
Thanks GESIOR for little help :p
Soon I will post this feature to anyone on OT.
Stay tuned! :)
 

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
@Fresh
Remember to check this left/right hand bug in case when you 'trade item'.
 
OP
Fresh

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
Thanks! Everything is fine with trade just checked now :)
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,069
Fixed ALL. // close thread plz.
Thanks GESIOR for little help :p
Soon I will post this feature to anyone on OT.
Stay tuned! :)
if he helped fix the issue please mark the post he helped you with as best answer
 
Top