diff options
-rw-r--r-- | pttbbs/include/proto.h | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 7 | ||||
-rw-r--r-- | pttbbs/mbbsd/cal.c | 19 | ||||
-rw-r--r-- | pttbbs/mbbsd/chicken.c | 2 |
4 files changed, 21 insertions, 9 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index 772aa4b3..e73b51c2 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -125,7 +125,7 @@ const char * postperm_msg(const char *bname); const char* money_level(int money); int vice(int money, const char* item); int pay(int money, const char *item, ...) GCC_CHECK_FORMAT(2,3); -int pay_as(int uid, int money, const char *item, ...) GCC_CHECK_FORMAT(3, 4); +int pay_as_uid(int uid, int money, const char *item,...)GCC_CHECK_FORMAT(3,4); int lockutmpmode(int unmode, int state); int unlockutmpmode(void); int x_file(void); diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index 6ee44c7a..920c7f6e 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -236,7 +236,7 @@ save_violatelaw(void) return 0; } - demoney(-1000 * cuser.vl_count); + pay(1000 * (int)cuser.vl_count, "繳付罰單 (#%d)", cuser.vl_count); pwcuSaveViolateLaw(); log_filef("log/violation", LOG_CREAT, "%s %s pay-violation: $%d complete.\n", @@ -1222,7 +1222,7 @@ do_general(int garbage) { if (money > 0) { - demoney(money); + pay(-money, "%s 看板發文稿酬: %s", currboard, postfile.title); pwcuIncNumPost(); addPost = 1; prints("這是您的第 %d 篇有效文章,獲得稿酬 %d 元\n", @@ -3204,7 +3204,8 @@ del_post(int ent, fileheader_t * fhdr, char *direct) { // owner case pwcuDecNumPost(); - demoney(-fhdr->multi.money); + pay(fhdr->multi.money, "%s 看板 文章自刪清潔費: %s", + currboard, fhdr->title); sendalert(cuser.userid, ALERT_PWD_PERM); vmsgf("您的文章減為 %d 篇,支付清潔費 %d 元", cuser.numposts, fhdr->multi.money); diff --git a/pttbbs/mbbsd/cal.c b/pttbbs/mbbsd/cal.c index 737a077c..38cbfa3c 100644 --- a/pttbbs/mbbsd/cal.c +++ b/pttbbs/mbbsd/cal.c @@ -94,7 +94,7 @@ do_pay(int uid, int money, const char *item, const char *reason) } int -pay_as(int uid, int money, const char *item, ...) +pay_as_uid(int uid, int money, const char *item, ...) { va_list ap; char reason[STRLEN*3] =""; @@ -310,6 +310,7 @@ static int do_give_money(char *id, int uid, int money, const char *myid) { int tax; + char prompt[STRLEN*2] = ""; reload_money(); if (money < 1 || cuser.money < money) @@ -319,9 +320,19 @@ do_give_money(char *id, int uid, int money, const char *myid) if (money - tax <= 0) return -1; /* 繳完稅就沒錢給了 */ - // 實際給予金錢。 - deumoney(uid, money - tax); - demoney(-money); + if (strcasecmp(myid, cuser.userid) != 0) { + snprintf(prompt, sizeof(prompt)-1, + "以 %s 的名義轉帳給 %s (稅後 $%d)", + myid, id, money - tax); + } else { + snprintf(prompt, sizeof(prompt)-1, + "轉帳給 %s (稅後 $%d)", id, money - tax); + } + + // 實際給予金錢。 為避免程式故障/惡意斷線,一律先扣再發。 + pay(money, "%s", prompt); + pay_as_uid(uid, -(money - tax), "來自 %s 的轉帳 (稅前 $%d)", + myid, money); log_filef(FN_MONEY, LOG_CREAT, "%-12s 給 %-12s %d\t(稅後 %d)\t%s\n", cuser.userid, id, money, money - tax, Cdate(&now)); diff --git a/pttbbs/mbbsd/chicken.c b/pttbbs/mbbsd/chicken.c index 907aa1c3..78f30b4d 100644 --- a/pttbbs/mbbsd/chicken.c +++ b/pttbbs/mbbsd/chicken.c @@ -468,7 +468,7 @@ ch_buyitem(int money, const char *picture, int *item) reload_money(); if (cuser.money/money >= num) { *item += num; - pay(money * num, "購買寵物"); + pay(money * num, "寵物商店"); show_chicken_picture(picture); pressanykey(); } else { |