V1, getItemPlayerProp ruppeeCount code seems wrong

While looking to: [url]OpenGraal · GitHub
(note, development branch, as it is said to be more recent)

[CODE]CString TLevelItem::getItemPlayerProp(const CString& pItemName, TPlayer* player)
{
int itemID = TLevelItem::getItemId(pItemName);
if (itemID == -1) return CString();

    switch (itemID)
    {
            case 0:         // greenrupee
            case 1:         // bluerupee
            case 2:         // redrupee
            case 19:        // goldrupee
            {
                    CString playerProp = player->GetPlayerProp(PLPROP_RUPEESCOUNT);
                    int rupeeCount = playerProp.readGInt();
                    if (itemID == 19) rupeeCount += 100;
                    else if (itemID == 2) rupeeCount += 30;
                    else if (itemID == 1) rupeeCount += 5;
                    else rupeeCount += 1;
                    rupeeCount = clip(rupeeCount, 0, 9999999);
                    return CString() >> (char)PLPROP_RUPEESCOUNT >> (int)rupeeCount;
            }[/CODE]

I believe rupeeCount += should become rupeeCount = rupeeCount div 100; etc.

Okay now i’m curious - are you just trying to create some productivity on the forums?

No. Are you trying to say that it is obviously a bug, and that I should have committed my fix without asking in the forum?

Not quite following why you would divide anything?

Say it was requested the number of redrupees that the player has (itemId==2), then I should give as answer, the number of rupees the player have divided by the value of a redrupee(30 green rupees). No?

What the fuck kind of math is that? I pick up a rupee and lose money?

That function returns the packet that the client needs in order to set the proper rupee count locally after receiving an item such as a red rupee.

So when the player picks up a red rupee, then the server will use that function like:

CString sendToClient = getItemPlayerProp(“redrupee”, player);

and then the server will send the packet stored in sendToClient to the client and the client will say “oh, okay, now I have X amount of total rupees”.

From what I’m getting, it seems like you thought it was to get the current count of any colored rupee, but no, it’s used to get the packet that would increment it properly on the client.

lol thanks Downsider I had no idea what on earth he was talking about