EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Fixed Quest Item Turn-in using $ItemCount() (https://www.eqemulator.org/forums/showthread.php?t=8227)

krich 06-21-2003 07:24 PM

Fixed Quest Item Turn-in using $ItemCount()
 
This was a pain...

In client_process.cpp, Client::HandlePacket

FROM:
Code:

parse->Event(EVENT_ITEM, tmp->GetNPCTypeID(), 0, tmp, this->CastToMob());
TO:
Code:

char tradeliststring[100];
memset(tradeliststring, 0, sizeof(tradeliststring));
for (int k = 0; k <=3; k++) {
        strncat(tradeliststring, itoa(TradeList[k]), sizeof(tradeliststring));
        strncat(tradeliststring, " ", sizeof(tradeliststring));
}
parse->Event(EVENT_ITEM, tmp->GetNPCTypeID(), tradeliststring, tmp, this->CastToMob());


Then, In parser.cpp, Parser::Event

FROM:
Code:

case EVENT_ITEM: {
                        SendCommands("event_item", qstID, npcmob, mob);
                        break;
                }

TO:
Code:

case EVENT_ITEM: {
                        char varname[20];
                        int token = 1;
                        char varvalue[10];
                        int v = 0;

                        memset(varname, 0, sizeof(varname));
                        memset(varvalue, 0, sizeof(varvalue));

                        for (int k=0; k<=strlen(data); k++) {
                                if (data[k] == ' ') {
                                        snprintf(varname, sizeof(varname), "item%d.%d", token, npcid);
                                        AddVar(varname, varvalue);
                                        memset(varvalue, 0, sizeof(varvalue));
                                        memset(varname, 0, sizeof(varname));
                                        token++;
                                        v=0;
                                }
                                else {
                                        varvalue[v] = data[k];
                                        v++;
                                }
                        }
                        SendCommands("event_item", qstID, npcmob, mob);
                        break;
                }


And finally, In parser.cpp, Parser:ParseVars

FROM:
Code:

if (record == 1 && pch[i] != ')')

TO:
Code:

                        if (record == 1 && pch[i] != ')' && pch[i]!='\"')
That should do it...

Regards,

krich

used_pawn 06-21-2003 08:52 PM

sorry for a stupid question, but what does this fix? (having trouble following the code)
hope im not offending, I just cant see it I guess.

krich 06-22-2003 07:49 AM

No problem. Hey, if I'm submitting bad code, no mercy...lol.

It passes the contents of the NPC trade window into the Event method so that they can be made into the variables $item1 through $item4 and then be used by the $itemcount() function.

I am going to take my name out of it though...hehe

Regards,

krich

Bigpull 06-22-2003 08:02 AM

Quote:

TO:
Code:
if (record == 1 && pch[i] != ')' && pch[i]!='\"')
Here is the actual problem, functions require " variables however didn't like them. Without digging out the code i'd assume just this would remedy most scripts.


All times are GMT -4. The time now is 12:40 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.