summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h3
-rw-r--r--mbbsd/cal.c19
-rw-r--r--mbbsd/talk.c5
3 files changed, 21 insertions, 6 deletions
diff --git a/include/proto.h b/include/proto.h
index fa30e640..30585329 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.8 2002/04/18 22:42:23 in2 Exp $ */
+/* $Id: proto.h,v 1.9 2002/05/02 06:20:31 lwms Exp $ */
#ifndef INCLUDE_PROTO_H
#define INCLUDE_PROTO_H
@@ -113,6 +113,7 @@ char *cachepath(const char *fpath);
int mdcacheopen(char *fpath);
/* cal */
+int give_tax(int money);
int vice(int money, char* item);
int inumoney(char *tuser, int money);
int cal();
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 6603925e..a5526783 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -1,4 +1,4 @@
-/* $Id: cal.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
+/* $Id: cal.c,v 1.3 2002/05/02 06:20:40 lwms Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -365,8 +365,19 @@ void mail_redenvelop(char* from, char* to, int money, char mode){
append_record(genbuf, &fhdr, sizeof(fhdr));
}
+/* 計算贈與稅 */
+int give_tax(int money)
+{
+ int tax = 0, tax_rate;
+ static int tax_bound[] = { 1000000, 100000, 10000, 1000 };
+ for( tax_rate = 0; tax_rate <= 3; tax_rate++ )
+ if ( money >= tax_bound[tax_rate] ) break;
+ tax = money * ( 0.5 - tax_rate/10.0 );
+ return tax;
+}
+
int p_give() {
- int money;
+ int money, tax;
char id[IDLEN + 1], genbuf[90];
time_t now = time(0);
@@ -378,7 +389,8 @@ int p_give() {
money = atoi(genbuf);
reload_money();
if(money > 0 && cuser.money >= money ) {
- deumoney(searchuser(id), money);
+ tax = give_tax(money);
+ deumoney(searchuser(id), money - tax);
demoney(-money);
now = time(NULL);
sprintf(genbuf,"%s\t給%s\t%d\t%s", cuser.userid, id, money,
@@ -387,6 +399,7 @@ int p_give() {
genbuf[0] = 'n';
getdata(3, 0, "要自行書寫紅包袋嗎?[y/N]", genbuf, 2, LCECHO);
mail_redenvelop(cuser.userid, id, money, genbuf[0]);
+ vice(tax, "贈與稅");
}
return 0;
}
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 463f1f71..6da4a0d2 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.23 2002/04/28 19:35:29 in2 Exp $ */
+/* $Id: talk.c,v 1.24 2002/05/02 06:20:40 lwms Exp $ */
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -2100,7 +2100,7 @@ static void pickup_user(void)
if (ch > cuser.money)
outs("\033[41m 現金不足~~\033[m");
else{
- deumoney(uentp->uid, ch);
+ deumoney(uentp->uid, ch - give_tax(ch));
sprintf(genbuf, "\033[44m 嗯..還剩下 %d 錢.."
"\033[m", demoney(-1*ch));
outs(genbuf);
@@ -2109,6 +2109,7 @@ static void pickup_user(void)
ctime(&currutmp->lastact));
log_file(FN_MONEY, genbuf);
mail_redenvelop(cuser.userid, uentp->userid, ch, 'Y');
+ vice(give_tax(ch), "贈與稅");
}
}
else{