📄 get.c
字号:
// Filename : /cmds/verb/get.c#include <ansi.h>inherit F_CLEAN_UP;int do_get(object me, object ob);void create() { seteuid(getuid()); }int main(object me, string arg){ string from, item; object obj, *inv, env, obj2; int i, amount; string wiz_status; wiz_status = SECURITY_D->get_status(me); if (userp(me) && !query_heart_beat(me)) { "/cmds/usr/quithy"->main(me); write("由于你没有心跳,请重新登陆!!\n"); } if( environment(me)->query("no_get") ) return notify_fail("这里不准捡东西。\n"); if( !arg ) return notify_fail("你要捡起什麽东西?\n"); if( me->is_busy() ) return notify_fail("你上一个动作还没有完成!\n"); // Check if a container is specified. if( sscanf(arg, "%s from %s", arg, from)==2 ) { env = present(from, me); if(!env) env = present(from, environment(me)); if(!env) return notify_fail("你找不到 " + from + " 这样东西。\n"); if( env->query_temp("no_kill") && env->query("pubmaster")) return notify_fail("此人不能get!\n"); if (userp(env) && !query_heart_beat(env)) { write("你想做什么!\n"); return notify_fail("此人无心跳!\n"); } if (userp(env) && env->query_temp("netdead")) { write("你想做什么!\n"); return notify_fail("此人无心跳!\n"); } if( (env->query("no_get_from") || living(env) ) && (wiz_level(me) <= wiz_level(env))) return notify_fail("你的巫师等级必须比对方高,才能搜身。\n"); if( userp(env) && query_ip_name(env)==query_ip_name(me) ) return notify_fail("相同IP之间,不允许搜身。\n"); if( (env->query("no_get_from") || living(env) ) && wiz_status != "(admin)" && wiz_status != "(arch)" && wiz_status != "(wizard)") return notify_fail("只有 (wizard) 以上的巫师才能搜身。\n"); } else env = environment(me); // Check if a certain amount is specified. if(sscanf(arg, "%d %s", amount, item)==2) { if( !objectp(obj = present(item, env)) ) return notify_fail("这里没有这样东西。\n"); if (userp(obj) && !query_heart_beat(obj)) return notify_fail("此人拿不起来。\n"); if (userp(obj) && !userp(me)) return notify_fail("NPC不能背人。\n"); if (userp(env) && env->query_temp("netdead")) return notify_fail("此人拿不起来。\n"); if( obj->query_temp("no_kill") && obj->query("pubmaster")) return notify_fail("此人拿不起来。\n"); if( obj->query_temp("no_kill") && obj->query("pubmaster") ) return notify_fail("此人拿不起来。\n"); if( !obj->query_amount() ) return notify_fail( obj->name() + "不能被分开拿走。\n"); if( amount < 1 ) return notify_fail("东西的个数至少是一个。\n"); if( amount > obj->query_amount() ) return notify_fail("这里没有那麽多的" + obj->name() + "。\n"); if (me->query("combat_exp") <1000 && userp(obj)) return notify_fail("只有经验大于1000才能背玩家。目前你还背不动。\n"); else if( amount == (int)obj->query_amount() ) { return do_get(me, obj); } else { obj->set_amount( (int)obj->query_amount() - amount ); obj2 = new(base_name(obj)); obj2->move(env); // For containers. obj2->set_amount(amount); // Counting precise amount costs more time. if( me->is_fighting() ) me->start_busy(4); return do_get(me, obj); } } // Check if we are makeing a quick get. if(arg=="all") { if( me->is_fighting() ) return notify_fail("你还在战斗中!只能一次拿一样。\n"); if( !env->query_max_encumbrance() ) return notify_fail("那不是容器。\n"); if( env->is_tree() ) return notify_fail("这是给新手活命用的,还是不要太贪心了吧
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -