Fixing Drops/Party/Vending/Attack

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Member bobbauk is offline
    MemberRank
    Aug 2006 Join Date
    51Posts

    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;
    }
    Last edited by bobbauk; 09-09-06 at 04:17 PM.


  2. #2
    Account Upgraded | Title Enabled! iNeverDownAway is offline
    MemberRank
    Jul 2006 Join Date
    846Posts
    and where the fuck i put it :S?
    can u put it on rar with your and send me pls :D?

  3. #3
    Member bobbauk is offline
    MemberRank
    Aug 2006 Join Date
    51Posts
    Quote Originally Posted by iNeverDownAway View Post
    and where the fuck i put it :S?
    can u put it on rar with your and send me pls :D?
    That is in worldpackets.cpp do a search in the .cpp and you will find the line. The code above is just comparing the two codes so maybe someone will get it working. No luck so far.

  4. #4
    Account Upgraded | Title Enabled! iNeverDownAway is offline
    MemberRank
    Jul 2006 Join Date
    846Posts
    can u share ur worldpackets.cpp?
    i dont good with this :/
    i scare i will delete something =(
    share ur worldpackets.cpp pls :D

  5. #5
    Cult of Personality zad67 is offline
    MemberRank
    Jun 2006 Join Date
    Over Here!Location
    349Posts
    iNeverDownAway - do you ever read before posting because that code above is already in the source he is saying that he will be comparing the two codes for fixing the drops.

  6. #6
    Account Upgraded | Title Enabled! iNeverDownAway is offline
    MemberRank
    Jul 2006 Join Date
    846Posts
    Quote Originally Posted by zad67 View Post
    iNeverDownAway - do you ever read before posting because that code above is already in the source he is saying that he will be comparing the two codes for fixing the drops.
    ur fix it right?
    but ur dont want give anyone..

  7. #7
    Cult of Personality zad67 is offline
    MemberRank
    Jun 2006 Join Date
    Over Here!Location
    349Posts
    ur fix it right?
    but ur dont want give anyone..
    iNeverDownAway - you are truely the most biggest fucking noob there ever was and is all you do is ask for this and that.

  8. #8
    Account Upgraded | Title Enabled! rl2171 is offline
    MemberRank
    Aug 2006 Join Date
    USALocation
    659Posts
    Here is a little simple thing I did.

    I didn't want the pause in the world server when I started each time, so in the worldserver.ccp this is what I did:

    Code:
    	}
    	Log( MSG_INFO, "Spawned %i monsters", MonsterList.size() );
    	float loadtime = (float)( clock() - timer ) / CLOCKS_PER_SEC;
    	Log( MSG_INFO, "Server took %.4f seconds to load", loadtime );
    
                 system("PAUSE");
    
    	return true;

    Code:
    	}
    	Log( MSG_INFO, "Spawned %i monsters", MonsterList.size() );
    	float loadtime = (float)( clock() - timer ) / CLOCKS_PER_SEC;
    	Log( MSG_INFO, "Server took %.4f seconds to load", loadtime );
    
    //  Remove pause from World server startup to start quicker
    //	system("PAUSE");
    	return true;
    I just remarked it out, just in case I ever needed it back in the future.

    I know just a simple one, but thought it might help.

  9. #9
    Member bobbauk is offline
    MemberRank
    Aug 2006 Join Date
    51Posts
    Quote Originally Posted by rl2171 View Post
    Here is a little simple thing I did.

    I didn't want the pause in the world server when I started each time, so in the worldserver.ccp this is what I did:

    Code:
    	}
    	Log( MSG_INFO, "Spawned %i monsters", MonsterList.size() );
    	float loadtime = (float)( clock() - timer ) / CLOCKS_PER_SEC;
    	Log( MSG_INFO, "Server took %.4f seconds to load", loadtime );
    
                 system("PAUSE");
    
    	return true;

    Code:
    	}
    	Log( MSG_INFO, "Spawned %i monsters", MonsterList.size() );
    	float loadtime = (float)( clock() - timer ) / CLOCKS_PER_SEC;
    	Log( MSG_INFO, "Server took %.4f seconds to load", loadtime );
    
    //  Remove pause from World server startup to start quicker
    //	system("PAUSE");
    	return true;
    I just remarked it out, just in case I ever needed it back in the future.

    I know just a simple one, but thought it might help.
    Handy! Thanks for the code!

    Guys if you have any other snippets of code which improve the server (big or small), feel free to post in the topic to help people.
    Last edited by bobbauk; 09-09-06 at 04:51 PM.

  10. #10
    Member shibii is offline
    MemberRank
    Dec 2005 Join Date
    canadaLocation
    96Posts
    ur fix it right?
    but ur dont want give anyone..
    dude read this

    That is in worldpackets.cpp do a search in the .cpp and you will find the line. The code above is just comparing the two codes so maybe someone will get it working. No luck so far.

  11. #11
    Account Upgraded | Title Enabled! jimowns is offline
    MemberRank
    Aug 2006 Join Date
    BelgiumLocation
    440Posts
    sorry dude but its don't works if i debug it ,its cannot open the .exe file :s

  12. #12
    Account Upgraded | Title Enabled! rl2171 is offline
    MemberRank
    Aug 2006 Join Date
    USALocation
    659Posts
    Quote Originally Posted by jimowns View Post
    sorry dude but its don't works if i debug it ,its cannot open the .exe file :s

    Which are you talking about? I know the one I did to get rid of the pause does work, or are you talking about the other code?

  13. #13
    Account Upgraded | Title Enabled! jimowns is offline
    MemberRank
    Aug 2006 Join Date
    BelgiumLocation
    440Posts
    if i change it i've got alot of errors . i use visual C++ express edition

  14. #14
    Enthusiast K34nu is offline
    MemberRank
    Sep 2006 Join Date
    38Posts
    LOL! Reading this for the first time! Zad67!!! 7th post in! Best post ever!

    iNeverDownAway - you are truely the most biggest fucking noob there ever was and is all you do is ask for this and that.
    -claps- Well played!!!

    -Keanu

  15. #15
    Member bobbauk is offline
    MemberRank
    Aug 2006 Join Date
    51Posts
    zad67 I sent you a pm which has vending/ride request code. Just needs to be configured to work with server.

    If you fix it, pm me back then I'll post it here



Page 1 of 2 12 LastLast

Advertisement