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 08-11-2004, 06:41 AM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default 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.
Reply With Quote
  #2  
Old 08-11-2004, 01:36 PM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default

What about those of us not usibg that version?
__________________
Maybe I should try making one of these servers...
Reply With Quote
  #3  
Old 08-11-2004, 03:08 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

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
Reply With Quote
  #4  
Old 08-11-2004, 11:49 PM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

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
Reply With Quote
  #5  
Old 08-12-2004, 01:20 AM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

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
Reply With Quote
  #6  
Old 08-12-2004, 05:10 AM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

I'll merge your autosplit code later fathernitwit.
Reply With Quote
  #7  
Old 08-12-2004, 05:23 AM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

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...
Reply With Quote
  #8  
Old 08-12-2004, 10:17 AM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

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.
Reply With Quote
  #9  
Old 08-12-2004, 11:42 AM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

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.
Reply With Quote
  #10  
Old 08-12-2004, 12:03 PM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

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.
Reply With Quote
  #11  
Old 08-12-2004, 12:18 PM
sotonin
Demi-God
 
Join Date: May 2004
Posts: 1,177
Default

lord of the rings adventure system? huh?
Reply With Quote
  #12  
Old 08-12-2004, 12:22 PM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

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.
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 11:20 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3