文字MUD游戏论坛-天下泥潭群英会-水泊梁山  

返回   文字MUD游戏论坛-天下泥潭群英会-水泊梁山 > 西游之旅 > 『 巫师天下 』

『 巫师天下 』 学习如何挂MUD,如何制作MUD。讨论如何管理好一个MUD,做好一个巫师。

发表新主题 回复
 
LinkBack 主题工具 评分: 主题评分: 1 票,平均 5.00 分。 显示模式
旧 2005-03-13   #1
初级会员
级别:3 | 在线时长:36小时 | 升级还需:14小时级别:3 | 在线时长:36小时 | 升级还需:14小时级别:3 | 在线时长:36小时 | 升级还需:14小时
 
dayu 的头像
 
注册: 05年03月12日
来自: 青岛
帖子: 35
声望力: 0
声望: 10 dayu 闻道则喜
现金:54两梁山币
资产:141两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
【转帖】qn银行制作(下)

/std/room/bank.c

//Cracked by Roath
// bank.c

inherit ROOM;

string money_str(int amount);
int pay_player(object who, int amount);
int large_deposit(int base_value, int amount);

void init()
{
add_action("do_convert", "convert");
add_action("do_deposit", "deposit");
add_action("do_check", "account");
add_action("do_withdraw", "withdraw");
add_action("do_credit", "credit");
// add_action("do_quit", "quit");
}

int do_convert(string arg)
{
string from, to;
int amount, bv1, bv2;
object from_ob, to_ob;

if( !arg || sscanf(arg, "%d %s to %s", amount, from, to)!=3 )
return notify_fail("指令格式:convert <数量> <货币种类> to <货币种类>\n");

if( this_player()->is_busy() )
return notify_fail("你现在正忙着呢...。\n");

from_ob = present(from + "_money", this_player());
to_ob = present(to + "_money", this_player());
if( !to_ob && file_size("/obj/money/" + to + ".c") < 0 )
return notify_fail("你想兑换哪一种钱?\n");

if( !from_ob ) return notify_fail("你身上没有这种货币。\n");
if( amount < 1 ) return notify_fail("兑换货币一次至少要兑换一个。\n");

if( (int)from_ob->query_amount() < amount )
return notify_fail("你身上没有那么多" + from_ob->query("name") + "。\n");

bv1 = from_ob->query("base_value");
if( !bv1 ) return notify_fail("这种东西不值钱。\n");

bv2 = to_ob ? to_ob->query("base_value") : call_other("/obj/money/" + to, "query", "base_value" );

if( bv1 < bv2 ) amount -= amount % (bv2 / bv1);
if( amount==0 ) return notify_fail("这些" + from_ob->query("name") + "的价值太低了,换不起。\n");
this_player()->start_busy(1);

if( !to_ob ) {
to_ob = new("/obj/money/" + to);
if(!(to_ob->move(this_player())))
return 0;
to_ob->set_amount(amount * bv1 / bv2);
} else
to_ob->add_amount(amount * bv1 / bv2);

message_vision( sprintf("$N从身上取出%s%s%s,换成%s%s%s。\n",
chinese_number(amount), from_ob->query("base_unit"), from_ob->query("name"),
chinese_number(amount * bv1 / bv2), to_ob->query("base_unit"), to_ob->query("name")),
this_player() );
if( (int)from_ob->query_amount() == amount )
destruct(from_ob);
else
from_ob->add_amount(-amount);

this_player()->save();

return 1;
}


int do_deposit(string arg)
{
string what;
int amount;
object what_ob, me;

me = this_player();

if(!arg || sscanf(arg, "%d %s", amount, what) !=2)
{
return notify_fail("命令格式:deposit <数量> <货币单位>\n");
}

if( this_player()->is_busy() )
return notify_fail("你现在正忙着呢...。\n");


what_ob = present(what + "_money", me);
if (!what_ob)
{
return notify_fail("你身上没有带这种钱。\n");
}
if (amount < 1)
{
return notify_fail("你想存多少" + what_ob->query("name") + "?\n");
}
if ((int)what_ob->query_amount() < amount)
{
return notify_fail("你带的" + what_ob->query("name") + "不够。\n");
}


me->start_busy(1);
message_vision(sprintf("$N拿出%s%s%s,存进了钱庄。\n",
chinese_number(amount), what_ob->query("base_unit"),
what_ob->query("name")), me);
if(to_float(me->query("balance"))+to_float(what_ob->query("base_value")) * to_float(amount)>=2000000000.0)
large_deposit(what_ob->query("base_value"),amount);
else me->add("balance", what_ob->query("base_value") * amount);
if ((int)what_ob->query_amount() == amount)
destruct(what_ob);
else
what_ob->add_amount(-amount);

me->save();

return 1;
}


int do_check()
{
object me=this_player();
int balance = (int)me->query("balance");
int bcredit = (int)me->query("bcredit");
if(!balance || balance < 0)
me->set("balance", 0);
else write("您在敝银庄共存有" + money_str(balance) + "\n");
if(!bcredit || bcredit < 0){
me->set("bcredit", 0);
if(me->query("balance")==0) return notify_fail("您在敝银庄没有存钱。\n");
}
else write("您在敝银庄共存有" +chinese_number(bcredit) + "个信用点。\n");
return 1;
}

int do_withdraw(string arg)
{
int amount, v, rv;
string what;
object me;

me = this_player();

if (!arg || sscanf(arg, "%d %s", amount, what) != 2)
{
return notify_fail("命令格式:withdraw <数量> <货币单位>\n");
}
if( this_player()->is_busy() )
return notify_fail("你现在正忙着呢...。\n");

if (amount < 1)
{
return notify_fail("你想取出多少钱?\n");
}
if (file_size("/obj/money/" + what + ".c") < 0)
{
return notify_fail("你想取出什么钱?\n");
}
what = "/obj/money/" + what;
if ((v = amount * what->query("base_value")) > me->query("balance"))
{
return notify_fail("你存的钱不够取。\n");
}
if( v < what->query("base_value") ) {
return notify_fail("Don't try, or I will purge you!\n");
}

me->start_busy(1);
/*
if( me->query("balance") > me->query("combat_exp")*100)
rv = v*8/10;
else
*/
//cuz there is upper limit now, disabled
//discount...weiqi,971226.
rv = v;

// player may not be able to carry the money.
// so what get out maybe less than he expected.
// mon 6/13/98
v=v-pay_player(me, rv);
me->add("balance", -v);
me->save();

message_vision(sprintf("$N从银号里取出%s。\n", money_str(v)),
me);

return 1;
}


string money_str(int amount)
{
// returns a chinese string of `amount` of money
string output;

if (amount / 10000) {
output = chinese_number(amount / 10000) + "两黄金";
amount %= 10000;
}
else
output = "";
if (amount / 100) {
output = output + chinese_number(amount / 100) + "两白银";
amount %= 100;
}
if (amount || sizeof(output)<2)
return output + chinese_number(amount) + "文铜板";
return output;
}


// return value is the amount which doesnot paid.
// mon 6/13/98
int pay_player(object who, int amount)
{
int v;
object ob;

seteuid(getuid());
if (amount < 1)
amount = 0;
if (v = amount / 10000) {
ob = new("/obj/money/gold");
ob->set_amount(amount / 10000);
if(!(ob->move(who)))
return amount;
amount %= 10000;
}
if (amount / 100) {
ob = new("/obj/money/silver");
ob->set_amount(amount / 100);
if(!(ob->move(who)))
return amount;
amount %= 100;
}
if (amount) {
ob = new("/obj/money/coin");
ob->set_amount(amount);
if(!(ob->move(who)))
return amount;
}
return 0;
}

int do_quit()
{
this_player()->move("/cmds/std/quitroom");
return 1;
}

int do_credit(string arg)
{
int balance,bcredit;
object me = this_player(),ob;
if(!arg)
return notify_fail("命令格式:credit credit|balance|withdraw\n");
if( this_player()->is_busy() )
return notify_fail("你现在正忙着呢...。\n");
balance=me->query("balance");
bcredit=me->query("bcredit");
if(!balance || balance<0 ) balance=0;
if(!bcredit || bcredit<0 ) bcredit=0;
if(arg=="credit")
{
if(balance<1000000000) return notify_fail("您存在钱庄的银子还不足以换取信用点。\n");
balance-=1000000000;
bcredit+=1;
message_vision("$N用自己的存款换取了一个信用点。\n", me);
}
else if(arg=="balance")
{
if(balance>500000000) return notify_fail("您的存款过多,请取出一些后再来兑换信用点。\n");
if(bcredit<1) return notify_fail("您还没有信用点可以兑换。\n");
balance+=1000000000;
bcredit-=1;
message_vision("$N将自己的一个信用点兑换成存款。\n", me);
}
else if(arg=="withdraw")
{
if(bcredit<1) return notify_fail("您还没有信用点,不能领取信用证!\n");
bcredit-=1;
ob=new("/obj/money/credit");
ob->set_amount(1);
if(!ob->move(me)) return notify_fail("对不起,银号出了点小问题,暂时不能付给您信用证。\n");
message_vision("$N从银号里取出一张信用证。\n", me);
}
else
return notify_fail("命令格式:credit credit|balance|withdraw\n");
me->set("balance",balance);
me->set("bcredit",bcredit);
me->start_busy(1);
me->save();
return 1;
}

int large_deposit(int base_value, int amount)
{
float total;
int bcredit, balance;
int ah,al,vh,vl;
object me=this_player();
balance=me->query("balance");
bcredit=me->query("bcredit");
total=to_float(me->query("balance"))+to_float(base_value) * to_float(amount);
bcredit+=to_int(total/1000000000.0);
vh=base_value/10000;vl=base_value%10000;
ah=amount/10000;al=amount%10000;
balance=balance%1000000000+(al*vl+(ah*vl+vh*al)%100000*10000+(ah*vh)%10*100000000)%1000000000;
me->set("balance",balance%1000000000);
me->set("bcredit",bcredit);
return 1;
}

此帖于 2005-03-13 05:57 被 dayu 编辑.

]. . NIKO钢琴 .
音乐 .

1942的葡萄酒 .

会秀的女人 .

放纵歌唱 . . .

http://wpa.qq.com/pa?p=1:100072036:11点这里可以给我直接发QQ信息哦!
帅哥 dayu 当前离线  
回复时引用此帖

旧 2005-06-03   #2
初级会员
级别:1 | 在线时长:7小时 | 升级还需:8小时
 
ppgg 的头像
 
注册: 05年06月03日
帖子: 43
声望力: 0
声望: 10 ppgg 闻道则喜
现金:-7两梁山币
资产:-4两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 【转帖】qn银行制作(下)

ppgg 当前离线  
回复时引用此帖
旧 2007-06-26   #3
初级会员
级别:0 | 在线时长:3小时 | 升级还需:2小时
 
gaopmail 的头像
 
注册: 07年06月22日
来自: 中国
帖子: 15
声望力: 0
声望: 10 gaopmail 闻道则喜
现金:8两梁山币
资产:8两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 【转帖】qn银行制作(下)

KKKKKKKKKKKKKKKKKKKKKKKKKKKK
帅哥 gaopmail 当前离线  
回复时引用此帖

旧 2007-08-16   #4
中级会员
级别:2 | 在线时长:15小时 | 升级还需:15小时级别:2 | 在线时长:15小时 | 升级还需:15小时
 
hxing 的头像
 
注册: 06年10月15日
帖子: 176
声望力: 19
声望: 10 hxing 闻道则喜
现金:1两梁山币
资产:28两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 【转帖】qn银行制作(下)

明出处:水泊梁山 http://www.aolai.org (http://www.skymud
hxing 当前离线  
回复时引用此帖
旧 2007-12-28   #5
中级会员
级别:3 | 在线时长:46小时 | 升级还需:4小时级别:3 | 在线时长:46小时 | 升级还需:4小时级别:3 | 在线时长:46小时 | 升级还需:4小时
 
feixiong521 的头像
 
注册: 05年05月06日
来自: 客栈
帖子: 79
声望力: 20
声望: 30 feixiong521 初领妙道
现金:0两梁山币
资产:121两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 【转帖】qn银行制作(下)

qn银行我喜欢,可是有了后乐趣少很多
帅哥 feixiong521 当前离线  
回复时引用此帖
旧 2008-02-19   #6
初级会员
级别:1 | 在线时长:7小时 | 升级还需:8小时
 
fitness 的头像
 
注册: 08年02月09日
帖子: 25
声望力: 0
声望: 10 fitness 闻道则喜
现金:25两梁山币
资产:25两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 【转帖】qn银行制作(下)

qian neng bank?
fitness 当前离线  
回复时引用此帖

旧 2008-06-01   #7
中级会员
级别:2 | 在线时长:24小时 | 升级还需:6小时级别:2 | 在线时长:24小时 | 升级还需:6小时
 
dgnsl 的头像
 
注册: 06年06月21日
帖子: 178
声望力: 19
声望: 10 dgnsl 闻道则喜
现金:423两梁山币
资产:423两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 【转帖】qn银行制作(下)

学习。。。。。。。。。。。。。。。。。。。
dgnsl 当前离线  
回复时引用此帖
旧 2008-12-04   #8
中级会员
级别:2 | 在线时长:29小时 | 升级还需:1小时级别:2 | 在线时长:29小时 | 升级还需:1小时
 
gold 的头像
 
注册: 08年11月28日
帖子: 68
声望力: 16
声望: 17 gold 初领妙道
现金:2两梁山币
资产:2两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 【转帖】qn银行制作(下)

总站里面应该没有这个功能吧!!
gold 当前离线  
回复时引用此帖

发表新主题 回复

添加到书签


发帖规则
不可以发表主师
不可以回复帖子
不可以上传附件
不可以编辑自己的帖子

论坛启用 vB 代码
论坛启用 表情图标
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
Trackbacks are 启用
Pingbacks are 启用
Refbacks are 启用



所有时间均为格林尼治时间 +9, 现在的时间是 10:05.


Powered by SPLS
版权所有 2001-2023 水泊梁山
皖ICP备05012024号

站长 fengyue

Content Relevant URLs by vBSEO 3.6.1