qn卡的制作
#include <ansi.h>
inherit ITEM;
int help(object me);
int create()
{
..............
}
void init()
{
add_action("do_withdraw","quchu");
add_action("do_deposit","cunru");
add_action("do_check","check");
}
int do_deposit(string arg)
{
string what;
int amount;
object me;
me = this_player();
if( me->is_busy()||me->is_fight())
return notify_fail("你现在正忙着呢...。\n");
if(arg && sscanf(arg, "%d %s", amount, what)==2 && what=="qn")
{
if ( me->query("b_potential")>=1000000000 )
if ( me->query("b_potential")>=2000000000 )
return notify_fail("你卡里的潜能已经够多了,赶紧去学习吧。\n");
if (amount < 1||me->query("potential")-me->query("learned_points") < 1)
return notify_fail("你想存多少潜能?\n");
if (amount>me->query("potential")-me->query("learned_points"))
return notify_fail("你的潜能不够存。\n");
if ( amount>=99999999 )
return notify_fail("你最多能存"HIY+chinese_number(99999999)+NOR"点潜能,赶紧去学习吧。\n");
message_vision(sprintf("$N拿出%s点潜能,存进了"HIY"卡"NOR"。\n",chinese_number(amount)), me);
me->add("b_potential", amount/100 * 99);
me->add("potential",-amount);
me->save();
return 1;
}
else
return help(me);
}
int do_withdraw(string arg)
{
int amount, v, rv;
string what;
object me;
me = this_player();
if( me->is_busy()||me->is_fight())
return notify_fail("你现在正忙着呢...。\n");
if (arg && sscanf(arg, "%d %s", amount, what) == 2 )
{
if (amount < 1)
return notify_fail("你想取多少?\n");
if(what=="qn")
{
if (amount > me->query("b_potential"))
return notify_fail("你卡里的潜能不够取。\n");
me->add("b_potential",-amount);
me->add("potential",amount);
me->save();
message_vision(sprintf("$N从"HIY"卡"NOR"里取出%s点潜能。\n",chinese_number(amount)),me);
return 1;
}
}
return help(me);
}
int do_check()
{
int total = (int)this_player()->query("b_potential");
if(!total || total < 0)
{
this_player()->set("b_potential", 0);
return notify_fail("您这张卡上没有任何潜能余额。\n");
}
write("您"HIY"卡"NOR"中目前还有" + chinese_number(total)+ "点"CYN"潜能"NOR"余额。\n");
return 1;
}
int help(object me)
{
write(@HELP
提取潜能:命令格式:quchu <数量> 潜能
存入潜能:命令格式:cunru <数量> 潜能
查询余额:命令格式:check
HELP
);
return 1;
}