Login
User Name:

Password:



Register
Forgot your password?
LOP Building Guide v1.0
Author: Hanaisse
Submitted by: Hanaisse
Reset Guide
Author: Hanaisse
Submitted by: Hanaisse
LOP 1.38r2
Author: Remcon
Submitted by: Remcon
LOP 1.37
Author: Remcon
Submitted by: Remcon
LOP 1.36
Author: Remcon
Submitted by: Remcon
Yahoo! Slurp, MSN Search

Members: 0
Guests: 2
Stats
Files
Topics
Posts
Members
Newest Member
369
3,185
15,632
526
Craty####
» SmaugMuds.org » Codebases » SmaugFUSS » need help with auction additi...
Forum Rules | Mark all | Recent Posts

need help with auction addition.
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jun 14, 2009, 9:59 pm   Last edited Jun 14, 2009, 10:11 pm by dbna2
Go to the bottom of the page Go to the top of the page
dbna2
Conjurer
GroupMembers
Posts287
JoinedDec 2, 2008

Hi I have been working on a loan system for my mud, it's an add on to the smaug banking system that is out there. basically I have it when you take out a loan u don't gain any money instead it is directly paided to the bank. The only problem is I am having trouble with the auction part of it. I want the auctioneer to take money out and pay off the bill, and if it has extra to give the extra to the person selling the item instead. This is what I have so far.

Code:
pay2 = 0;
if ( auction->seller->pcdata->stats[LOAN] > 0 )
{
 
 if( auction->seller->pcdata->stats[LOAN] < 0 )
{ 
 pay2 = (int) auction->seller->pcdata->stats[LOAN] * 2;
 pay2 = (int) pay2 / 2;
 auction->seller->pcdata->stats[LOAN] = 0;
}
else
{
pay2 = 0;
}
 auction->seller->gold += pay2; /* give him the money, tax 10 */
 ch_printf( auction->seller,
                        "The auctioneer pays you %s zeni, charging an fee of ",
                                num_punct(pay2));
                ch_printf( auction->seller, "%s.\n\r", num_punct(tax));
stc("&CThe Auctioneer says 'Since you owe the bank money I have given them what I could and given you the rest'&D", auction->seller );
}
else
{

                auction->seller->gold += pay; /* give him the money, tax 10 % */                
		ch_printf( auction->seller,
			"The auctioneer pays you %s zeni, charging an auction fee of ",
				num_punct(pay));
		ch_printf( auction->seller, "%s.\n\r", num_punct(tax));
}
it doesn't work at all, not sure what to do about it. thanks in advance. .........................
http://img196.imageshack.us/img196/5134/nandjsig.jpg
Homepage: dbnu.info
Dbnu.info: 4321
       
Post is unread #2 Jun 15, 2009, 7:46 pm
Go to the bottom of the page Go to the top of the page
dbna2
Conjurer
GroupMembers
Posts287
JoinedDec 2, 2008

If you need more information let me know. .........................
http://img196.imageshack.us/img196/5134/nandjsig.jpg
Homepage: dbnu.info
Dbnu.info: 4321
       
Post is unread #3 Jun 16, 2009, 2:52 am
Go to the bottom of the page Go to the top of the page
dbna2
Conjurer
GroupMembers
Posts287
JoinedDec 2, 2008

Fixed this, seen the problem when I wasn't so tired. thanks for the help anyways. .........................
http://img196.imageshack.us/img196/5134/nandjsig.jpg
Homepage: dbnu.info
Dbnu.info: 4321
       
Post is unread #4 Jun 29, 2009, 9:17 am   Last edited Jun 29, 2009, 9:17 am by paradox24
Go to the bottom of the page Go to the top of the page
paradox24
Fledgling
GroupMembers
Posts18
JoinedMar 6, 2009

GAH .. gimme a second made a mistake :P
       
Post is unread #5 Jun 29, 2009, 9:25 am
Go to the bottom of the page Go to the top of the page
paradox24
Fledgling
GroupMembers
Posts18
JoinedMar 6, 2009

Code:
pay2 = 0;
if ( auction->seller->pcdata->stats[LOAN] > 0 )     <--- so what you're saying is if he HAS a loan out
{
 
 if( auction->seller->pcdata->stats[LOAN] < 0 )       <--- this part is in the wrong spot, we already know its > 0
{ 
 pay2 = (int) auction->seller->pcdata->stats[LOAN] * 2;
 pay2 = (int) pay2 / 2;                                               <----^---------------  you're multiplying by 2, then dividing by 2.. just assign it
 auction->seller->pcdata->stats[LOAN] = 0;     <------      and then you're clearing the loan
}
else
{
pay2 = 0;       <---- pay2 already = 0
}
 auction->seller->gold += pay2; /* give him the money, tax 10 */
 ch_printf( auction->seller,
                        "The auctioneer pays you %s zeni, charging an fee of ",
                                num_punct(pay2));
                ch_printf( auction->seller, "%s.\n\r", num_punct(tax));
stc("&CThe Auctioneer says 'Since you owe the bank money I have given them what I could and given you the rest'&D", auction->seller );
}
else
{

                auction->seller->gold += pay; /* give him the money, tax 10 % */                
		ch_printf( auction->seller,
			"The auctioneer pays you %s zeni, charging an auction fee of ",
				num_punct(pay));
		ch_printf( auction->seller, "%s.\n\r", num_punct(tax));
}


ok .. now for the rest of it ... I think what you're trying to do is this ...

if( ch->loan > 0 )
  pay2 = pay * 9 / 10;
if( ch->loan <= 0 )
  pay2 = 0;

auction->seller->gold -= pay2;
ch->gold += auction->seller->gold;

if( pay2 > 0)
  ch_printf( "Because of your bank loan, %d of your profits has been given to the bank.", pay2 );

ch_printf( "The auctioneer charges you %d zeni ..."  ..... etc etc etc

this way you're making pay2 = the amount that is taken from the profits, removing it from the amount given to the player, and then continuing the normal auction proceedings ...

does this make sense or am I missing what you wanted to do?
       
Pages:<< prev 1 next >>