|  |  | 
 
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  | 
	
		
   
   
      | Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days. |  
	
	
		
	
	
	| 
			
			 
			
				08-11-2004, 06:41 AM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Jul 2004 
						Posts: 773
					      |  |  
	| 
				 Implemented Split and Autosplit 
 Hey, 
I have implemented the /split and /autosplit functions.
http://eqemu.psend.com/split_with_auto.diff 
Patch in the zone directory against 7-31 CVS... applies clean, havent tried to run it with just this patch, but it works in my server repository.
 
let me know if anybody has success or failure with this. |  
	
		
	
	
	| 
			
			 
			
				08-11-2004, 01:36 PM
			
			
			
		 |  
	| 
		
			|  | Demi-God |  | 
					Join Date: Mar 2003 Location: USA 
						Posts: 1,067
					      |  |  
	| 
 What about those of us not usibg that version?  
				__________________Maybe I should try making one of these servers...
 |  
	
		
	
	
	| 
			
			 
			
				08-11-2004, 03:08 PM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Jul 2004 
						Posts: 773
					      |  |  
	| 
 the changes are pretty straight forward...  you can prolly just read the patch file and copy as needed... but I really have no idea what any code more than about 2 weeks looks like   , and I know yours is rather old |  
	
		
	
	
 
  |  |  |  |  
	| 
			
			 
			
				08-11-2004, 11:49 PM
			
			
			
		 |  
	| 
		
			
			| Old-EQEmu Developer |  | 
					Join Date: Oct 2002 Location: Spain 
						Posts: 323
					      |  |  
	| 
				  
 not sure if works,but try this code(didnt test): 
in groups.h:
 
	Code: void    SplitMoney(uint32 platinum,uint32 gold,uint32 silver,uint32 copper) ; in groups.cpp:
 
	Code: void Group::SplitMoney(uint32 platinum,uint32 gold,uint32 silver,uint32 copper) 
{ 
	APPLAYER* outapp = new APPLAYER(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct)); 
	moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer; 
	d->copper=0;
	d->silver=0;
	d->platinum=0;
	d->gold=0;
	d->response      = 1; 
	d->unknown1      = 0x5a; 
	d->unknown2      = 0x40; 
	d->unknown3      = 0; 
      int i; 
      int8 membercount = 0; 
      for (i = 0; i < MAX_GROUP_MEMBERS; i++) 
         if (members[i] != NULL)
			 membercount++;
	  d->platinum=(int)(platinum/membercount);
	  d->gold=(int)(gold/membercount);
	  d->silver=(int)(silver/membercount);
	  d->copper=(int)(copper/membercount);
      if (membercount == 0) 
         return; 
	  if(d->platinum<0)
		  d->platinum=0;
	  if(d->gold<0)
		  d->gold=0;
	  if(d->silver<0)
		  d->silver=0;
	  if(d->copper<0)
		  d->copper=0;
      for (i = 0; i < MAX_GROUP_MEMBERS; i++) 
      { 
         if (members[i] != NULL && members[i]->IsClient()) // If Group Member is Client
		 {
			 members[i]->CastToClient()->AddMoneyToPP(d->copper,d->gold,d->silver,d->platinum,true);
			 members[i]->CastToClient()->QueuePacket(outapp);
			 members[i]->CastToClient()->Message(0,"You receive %i platinum,%i gold,%i silver and %i copper for the split.",d->platinum,d->gold,d->silver,d->copper);
		 } 
      } 
	  safe_delete(outapp);
} in client.cpp,replace existant op_split:
 
	Code: 				case OP_Split: {
					// solar: the client removes the money on its own, but we have to
					// update our state anyway, and make sure they had enough to begin
					// with.
					Split_Struct *split = (Split_Struct *)app->pBuffer;
					Group* group;
					uint32 pp=split->platinum;
					uint32 gold=split->gold;
					uint32 silver=split->silver;
					uint32 copper=split->copper;
					if(!TakeMoneyFromPP((copper+(silver*10)+(gold*100)+(pp*1000))))
					{
						Message(0,"You haven't got enough money!");
						break;
					}
					group = entity_list.GetGroupByClient(this);
					group->SplitMoney(pp,gold,silver,copper);
					break;
				} Let me know if works
			
			
			
			
				  |  
 
  |  |  |  |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 01:20 AM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Jul 2004 
						Posts: 773
					      |  |  
	| 
 im not trying to be a dick or anything, but there is a lot wrong with that code... my solution is much more complete and does most things very similarly... just some examples: 
1. *edit* didnt see the takemoneyfrompp, nevermind. 
2. it dosent handle rounding at all.. so everything rounds down (money disappears) 
3. dosent send any money updates so nobody will see their splits 
4. a uint* can never be negative   |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 05:10 AM
			
			
			
		 |  
	| 
		
			
			| Old-EQEmu Developer |  | 
					Join Date: Oct 2002 Location: Spain 
						Posts: 323
					      |  |  
	| 
 I'll merge your autosplit code later fathernitwit. |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 05:23 AM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Jul 2004 
						Posts: 773
					      |  |  
	| 
 Cool,
 Have you actually tested with the OP_MoneyOnCorpse, instead of a full money update? I wasnt able to get it to work, it didnt seem to do anything... also a little cleanup might be to call SendClientMoneyUpdate (just found it) instead of building the money update packet in the split routine...
 |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 10:17 AM
			
			
			
		 |  
	| 
		
			
			| Old-EQEmu Developer |  | 
					Join Date: Oct 2002 Location: Spain 
						Posts: 323
					      |  |  
	| 
 it worked for me,I have seen something wrong in your code btw.where it says AT_AUTOSPLIT or something like that,you are sending that packet to other people,and no one want to know that you have auto split on,except the server.I have tested all stuff and works.
 |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 11:42 AM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Jul 2004 
						Posts: 773
					      |  |  
	| 
 
	Quote: 
	
		| 
					Originally Posted by cofruben
					
				 where it says AT_AUTOSPLIT or something like that,you are sending that packet to other people,and no one want to know that you have auto split on,except the server. |  lol, oops... copy paste error from whatever block was directly above it    
patch has been updated. |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 12:03 PM
			
			
			
		 |  
	| 
		
			
			| Old-EQEmu Developer |  | 
					Join Date: Oct 2002 Location: Spain 
						Posts: 323
					      |  |  
	| 
 nice...i am going to work in ldon adventure system...would you help me,fathernitwit?it requires a lot of work and things to be collected,so the help of people are very good accepted. |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 12:18 PM
			
			
			
		 |  
	| 
		
			
			| Demi-God |  | 
					Join Date: May 2004 
						Posts: 1,177
					      |  |  
	| 
 lord of the rings adventure system? huh? |  
	
		
	
	
	| 
			
			 
			
				08-12-2004, 12:22 PM
			
			
			
		 |  
	| 
		
			
			| Old-EQEmu Developer |  | 
					Join Date: Oct 2002 Location: Spain 
						Posts: 323
					      |  |  
	| 
 lotr system?what?you should go to the occulist...lol ,joke   . 
Yeah I was thinking about lotr at that moment,but I tried to say ldon   .Like adventures and so. |  
	
		
	
	
	
	
	| 
	|  Posting Rules |  
	| 
		
		You may not post new threads You may not post replies You may not post attachments You may not edit your posts 
 HTML code is Off 
 |  |  |  All times are GMT -4. The time now is 09:30 AM.
 
 |  |  
    |  |  |  |  
    |  |  |  |  
     |  |  |  |  
 |  |