Page 1 of 2

[Dev Rev II] Crafting Gem stack bug (solved)

PostPosted: Thu Mar 29, 2012 2:55 am
by kismetbecomes
Using Dev Rev II.
naRose 307.

and Lmame said this is fixed in dev rev II.
:? This means I'm a lil bit screwed.

CASE:
Crafted a new GEM.
Occupies a slot (of course)
But the next time you craft,
the gem is still [1] even tho
I've crafted many.. all success.
By dropping [1] gem.. the numbers
returns back to its "supposed" number of items crafted.

I guess the problem is that - new items coming
from craft's success overlaps the existing items
in the inventory.

Posted a similar question here: viewtopic.php?f=30&t=3192
*but nobody might have seen it..
Looking forward for your help. Thank you.

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Thu Mar 29, 2012 10:35 am
by Mark
Ok here's the Fix:

Search in:
bool CWorldServer::pakCraft( CPlayer* thisclient, CPacket* P )

Find:
  1. thisclient->items[newslot] = item;

**Note: There are 3 sections where this code line can be found, upon searching for the above code, the 1st section will be for PAT items, click search again, the next section will be for Quest Items, click search again, the 3rd and final search result will be the section you require to post this code.

Add before the above code
  1. if (item.itemtype>=10&&item.itemtype<=12)
  2. {
  3.     item.count+=thisclient->items[newslot].count;
  4. }


So your Final code looks a little like this:
  1. if (item.itemtype>=10&&item.itemtype<=12)
  2. {
  3.     item.count+=thisclient->items[newslot].count;
  4. }
  5.  
  6. thisclient->items[newslot] = item;


Your going to need to ensure that you have placed the code in the right place, otherwise it will not work.

Any problems, post em here.

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Thu Mar 29, 2012 12:45 pm
by kismetbecomes
"bool CWorldServer::pakCraft( CPlayer* thisclient, CPacket* P )" is inside worldpackets.cpp right?

*If yes, then the codes are already there.
I think lmame added it himself.


  1.        //LMA: Stackable fix.
  2.         if (item.itemtype>=10&&item.itemtype<=12)
  3.         {
  4.             item.count+=thisclient->items[newslot].count;
  5.         }
  6.  
  7.         thisclient->items[newslot] = item;


Found that inside worldpackets.cpp
It's already there.


And. There is only ONE :
  1. thisclient->items[newslot] = item;
inside that file.

I'm sorry. Maybe I'm just really dumb. I'm not much of a coder.

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Thu Mar 29, 2012 2:17 pm
by Mark
Ok try this:

Find this:
  1.  
  2. if (item.itemtype == 11)
  3. {
  4. ADDWORD( pak, 0x0001);// amount
  5. ADDWORD( pak, 0x0000);
  6. }
  7. else
  8. {
  9. ADDDWORD(pak, BuildItemData(item));
  10. }
  11.  


Replace with this
  1. ADDDWORD(pak, BuildItemData(item));


So your final code would just look like this:
  1. ADDDWORD(pak, BuildItemData(item));


Nothing else, nothing more.

Again Let me know if this fixes it for you.

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Thu Mar 29, 2012 3:20 pm
by kismetbecomes
I'm sorry. It didn't.
Do I have to recompile exe stuff or just replace that as is?
coz that's what I kinda did.

Can we - (and by that I mean you :D ) - like
make the new crafted gems not STACK to the existing
items in the inventory? That way the new
items wont overlap. Hope that gives you an idea.

And by the way, my materials can exceed to 10000+..
its supposed to have like 999 only.. right?

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Fri Mar 30, 2012 12:28 am
by Circa
each time you add code you recompile

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Fri Mar 30, 2012 3:43 am
by kismetbecomes
Circa wrote:each time you add code you recompile


Oh sorry. Thought I'll simply replace or add codes to cpp files and that's it. :roll:
(I can be very stupid sometimes.) :cry:

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Fri Mar 30, 2012 3:51 am
by kismetbecomes
Circa wrote:each time you add code you recompile


Circa, if I may clarify it..
Found this code existing in my cpp file. (worldpackets)
(bug still there)
  1.  //LMA: Stackable fix.
  2.         if (item.itemtype>=10&&item.itemtype<=12)
  3.         {
  4.             item.count+=thisclient->items[newslot].count;
  5.         }
  6.  
  7.         thisclient->items[newslot] = item;
  8.  



Mark suggested to replace this:

  1. if (item.itemtype == 11)
  2. {
  3. ADDWORD( pak, 0x0001);// amount
  4. ADDWORD( pak, 0x0000);
  5. }
  6. else
  7. {
  8. ADDDWORD(pak, BuildItemData(item));
  9. }


with this

  1. ADDDWORD(pak, BuildItemData(item));



after doing that..
I'll recompile the cbp server file and make new exe. Right? :(

Re: [Dev Rev II] still getting the stack bug.

PostPosted: Fri Mar 30, 2012 7:28 am
by kismetbecomes
Mark! :o
Your FIX worked! (the second)
Thanks Man! :D :lol:

Re: [Dev Rev II] Crafting Gem stack bug (solved)

PostPosted: Fri Mar 30, 2012 7:43 am
by Circa
Just remember when you add new code that you have to recompile it to make the new .exe