Fixing Drops/Party/Vending/Attack
These are the things I most want to get working. Drop list, party/vending skills and the attack damage from player and monster.
You can use this topic to post code snippets if you have fixed this, or trying to fix these things.
I am going to compare the drop code of the drose source and erose source and see if I can get any working. I will post if I fix it.
Anyone able to help everyone fix these things?
erose drop code:
Code:
// Drops item on map
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakDoDrop( CWorldClient* thisclient, CPacket* P )
{
unsigned itemid = GETBYTE((*P), 0x0);
unsigned amount = GETDWORD((*P), 0x1);
if (itemid == 0) {
if (amount < 1) return true;
if (thisclient->c_zuly < amount) return true;
CDrop* thisdrop = new CDrop;
thisdrop->clientid = GetNewClientID();
thisdrop->type = 1; // ZULY
thisdrop->pos.x = thisclient->pos.x;
thisdrop->pos.y = thisclient->pos.y;
thisdrop->posMap = thisclient->posMap;
thisdrop->droptime = time(NULL);
thisdrop->amount = amount;
thisdrop->owner = 0;
DropsList.push_back( thisdrop );
thisclient->c_zuly -= amount;
BEGINPACKET( pak, 0x71d );
ADDQWORD( pak, thisclient->c_zuly );
thisclient->SendPacket( &pak );
}else{
CDrop* thisdrop = new CDrop;
thisdrop->clientid = GetNewClientID();
thisdrop->type = 2; // ITEM
thisdrop->pos.x = thisclient->pos.x;
thisdrop->pos.y = thisclient->pos.y;
thisdrop->posMap = thisclient->posMap;
thisdrop->droptime = time(NULL);
thisdrop->amount = amount;
thisdrop->item = thisclient->items[itemid];
thisdrop->item.count = amount;
thisdrop->owner = 0;
DropsList.push_back( thisdrop );
thisclient->items[itemid].count -= amount;
if(thisclient->items[itemid].count <= 0) ClearItem(thisclient->items[itemid]);
BEGINPACKET( pak, 0x718 );
ADDBYTE( pak, 1);
ADDBYTE( pak, itemid);
ADDDWORD( pak, BuildItemHead( thisclient->items[itemid] ) );
ADDDWORD( pak, BuildItemData( thisclient->items[itemid] ) );
thisclient->SendPacket( &pak );
}
return true;
drose code:
Code:
bool CWorldServer::pakDoDrop( CWorldClient* thisclient, CPacket* P )
{
unsigned dropid = GetNewClientID();
unsigned itemid = GETBYTE((*P), 0x0);
unsigned amount = GETDWORD((*P), 0x1);
if (itemid == 0) {
if (thisclient->c_zuly < amount) {
ClearClientID(dropid);
return true;
}
thisclient->c_zuly -= amount;
STARTPACKET(pak1,0x71d,14);
SETDWORD( pak1, 0x000, thisclient->c_zuly );
SETDWORD( pak1, 0x004, 0x00000000 );
thisclient->SendPacket( &pak1 );
{
//boost::mutex::scoped_lock scoped_lockc( ClientListMutex );
for(unsigned j=0; j<ClientList.size(); j++) {
CWorldClient* otherclient = (CWorldClient*)ClientList.at( j );
if (thisclient->c_posMap == otherclient->c_posMap && otherclient->inGame) {
STARTPACKET(pak,0x7a6,26);
SETDWORD( pak, 0x000, thisclient->getposx() );
SETDWORD( pak, 0x004, thisclient->getposy() );
SETWORD( pak, 0x008, 0xccdf );
SETDWORD( pak, 0x00a, amount );
SETWORD( pak, 0x00e, dropid );
SETWORD( pak, 0x010, 0x0000 );
SETWORD( pak, 0x012, 0x5f90 );
otherclient->SendPacket( &pak );
}
}
}
DropsList[dropid].map = thisclient->c_posMap;
DropsList[dropid].type = 1; // ZULY
DropsList[dropid].droptime = (unsigned)time(NULL);
DropsList[dropid].amount = amount;
}else{
// ITEM DROP
{
//boost::mutex::scoped_lock scoped_lockc( ClientListMutex );
for(unsigned j=0; j<ClientList.size(); j++) {
CWorldClient* otherclient = (CWorldClient*)ClientList.at( j );
if (thisclient->c_posMap == otherclient->c_posMap && otherclient->inGame) {
STARTPACKET(pak2,0x7a6,26);
SETDWORD( pak2, 0x000, thisclient->getposx() );
SETDWORD( pak2, 0x004, thisclient->getposy() );
SETWORD( pak2, 0x008, (thisclient->items[itemid].itemnum<<5)|thisclient->items[itemid].itemtype );
SETWORD( pak2, 0x00a, 0x003b );
SETWORD( pak2, 0x00c, 0x0000 );
SETWORD( pak2, 0x00e, dropid );
SETWORD( pak2, 0x010, thisclient->items[j].durability<<9 );
SETWORD( pak2, 0x012, thisclient->items[j].lifespan*10 );
otherclient->SendPacket( &pak2 );
}
}
}
STARTPACKET(pak3,0x718,14);
SETBYTE( pak3, 0x00, 1); // ITEMS TO UPDATE
SETBYTE( pak3, 0x01, itemid);
SETWORD( pak3, 0x02, 0 ); // UNKNOWN
SETWORD( pak3, 0x04, 0 );
SETWORD( pak3, 0x06, 0 );
thisclient->SendPacket(&pak3);
DropsList[dropid].map = thisclient->c_posMap;
DropsList[dropid].type = 2; // ITEM
DropsList[dropid].droptime = (unsigned)time(NULL);
DropsList[dropid].amount = amount;
DropsList[dropid].item = thisclient->items[itemid];
thisclient->items[itemid].durability = 0;
thisclient->items[itemid].itemnum = 0;
thisclient->items[itemid].itemtype = 0;
thisclient->items[itemid].lifespan = 0;
thisclient->items[itemid].refine = 0;
}
return true;
}