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.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-30-2002, 02:39 AM
foley
Fire Beetle
 
Join Date: Jan 2002
Posts: 12
Default

Code Directions
Add Zoneobject.cpp and ZoneObject.h to your project.

Add the following line to Client::Process() inside the if (Connected()) block:
zone->CheckZoneObjects();

Modify the case CLIENT_CONNECTING4: { in client_process.cpp block to look like the following:
if (app->opcode == 0x0a20)
{
cout << "Login packet 4" << endl;

APPLAYER* outapp;

ZoneObject_Struct *zos;
ZoneObject_Struct *dzos;
int numzoneobjects,deflatedsize;

numzoneobjects=zone->GetZoneObjects(zos);
if(numzoneobjects>0)
{
dzos=new ZoneObject_Struct[numzoneobjects];
deflatedsize=DeflatePacket((unsigned char*)(zos), sizeof(ZoneObject_Struct)*numzoneobjects, (unsigned char*)(dzos), sizeof(ZoneObject_Struct)*numzoneobjects);
delete zos;

outapp = new APPLAYER;
outapp->pBuffer = new uchar[deflatedsize+2];
outapp->opcode = 0xf721;
*(int16 *)(outapp->pBuffer)=numzoneobjects;
memcpy((outapp->pBuffer)+2, dzos, deflatedsize);
outapp->size = deflatedsize+2;
packet_manager.MakeEQPacket(outapp);
delete outapp;
delete dzos;
}

outapp = new APPLAYER;
outapp->opcode = 0xd820; // Unknown
outapp->size = 0;
QueuePacket(outapp);
delete outapp;

client_state = CLIENT_CONNECTING5;
break;
}
}


Add the following case to the switch(app->opcode) block that is within the case CLIENT_CONNECTED in client_process.cpp
case OP_ZoneObjectOpenRequest: {
APPLAYER *outapp;
ZoneObjectOpen_Struct *zoos = (ZoneObjectOpen_Struct *)app->pBuffer;
ZoneObject *zo=zone->GetZoneObject(zoos->zoneobject_id);
cout << "zoneobjectid=" << int(zo->GetZoneObjectID()) << " initialstate=" << int(zo->zoneobjectstruct.initialstate) << " item=" << uint32(zoos->item_nr) << endl;
if(zo && zo->zoneobjectstruct.initialstate) // check if open
{
cout << "closing zone object" << endl;
outapp = new APPLAYER;
outapp->opcode=OP_ZoneObjectOpen;
outapp->size=2;
outapp->pBuffer=new uchar[outapp->size];
outapp->pBuffer[0]=zoos->zoneobject_id;
outapp->pBuffer[1]=0x03; // seems to say 'close'

entity_list.QueueCloseClients(this,outapp,true); // tell other clients
packet_manager.MakeEQPacket(outapp); // tell client who closed the object
delete outapp;

zo->zoneobjectstruct.initialstate=0;
zone->CloseZoneObject(zoos->zoneobject_id);
}
else if(zo && (zoos->item_nr==0xffff || zo->GetKeyNumber()==zoos->item_nr || zoos->item_nr==0x0000))
{
cout << "opening zone object" << endl;
outapp = new APPLAYER;
outapp->opcode=OP_ZoneObjectOpen;
outapp->size=2;
outapp->pBuffer=new uchar[outapp->size];
outapp->pBuffer[0]=zoos->zoneobject_id;
outapp->pBuffer[1]=0x02; // seems to say 'open'
if(zoos->item_nr==0x0000)
{
cout << "auto close request?" << endl;
outapp->pBuffer[1]=0x03;
}

entity_list.QueueCloseClients(this,outapp,true); // tell other clients
packet_manager.MakeEQPacket(outapp); // tell client who opened the door
delete outapp;

zo->zoneobjectstruct.initialstate=1;
zone->AddOpenedZoneObject(zoos->zoneobject_id, zo->opentimer);
}
else if(zo)
{
Message(13, "It's locked and you're not holding the key.");
break;
}
if(zo)
{
uint32 triggerid=zo->trigger_id;
if(triggerid!=65535)
{
ZoneObject *tzo=zone->GetZoneObject(triggerid);
if(tzo && tzo->zoneobjectstruct.initialstate && !zone->GetZoneObjectStatus(triggerid)) // check if open
{
cout << "closing triggered object:" << triggerid << endl;
outapp = new APPLAYER;
outapp->opcode=OP_ZoneObjectOpen;
outapp->size=2;
outapp->pBuffer=new uchar[outapp->size];
outapp->pBuffer[0]=triggerid;
outapp->pBuffer[1]=0x03; // seems to say 'close'
entity_list.QueueCloseClients(this,outapp,true); // tell other clients
packet_manager.MakeEQPacket(outapp); // tell client who closed the object
delete outapp;

tzo->zoneobjectstruct.initialstate=0;
zone->AddOpenedZoneObject(triggerid, tzo->opentimer);
}
else if(tzo && !zone->GetZoneObjectStatus(triggerid))
{
cout << "opening triggered object:" << triggerid << endl;
outapp = new APPLAYER;
outapp->opcode=OP_ZoneObjectOpen;
outapp->size=2;
outapp->pBuffer=new uchar[outapp->size];
outapp->pBuffer[0]=triggerid;
outapp->pBuffer[1]=0x02; // seems to say 'open'
entity_list.QueueCloseClients(this,outapp,true); // tell other clients
packet_manager.MakeEQPacket(outapp); // tell client who opened the door
delete outapp;

tzo->zoneobjectstruct.initialstate=1;
zone->AddOpenedZoneObject(triggerid, tzo->opentimer);
}
}
}
break;
}
Reply With Quote
 


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 06:54 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