Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-21-2003, 07:24 PM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default 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
Reply With Quote
  #2  
Old 06-21-2003, 08:52 PM
used_pawn
Sarnak
 
Join Date: Apr 2003
Posts: 53
Default

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.
Reply With Quote
  #3  
Old 06-22-2003, 07:49 AM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default

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
Reply With Quote
  #4  
Old 06-22-2003, 08:02 AM
Bigpull
Discordant
 
Join Date: Feb 2003
Posts: 305
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:30 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3