本文整理汇总了C++中object::accept_object方法的典型用法代码示例。如果您正苦于以下问题:C++ object::accept_object方法的具体用法?C++ object::accept_object怎么用?C++ object::accept_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::accept_object方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_give
int do_give(object me, object obj, object who)
{
mixed no_give;
if(me->is_busy())
return notify_fail("你正忙着呢...\n");
if(who->is_busy())
return notify_fail("对方正忙着呢,没时间理你...\n");
if(who->query("env/no_accept"))
return notify_fail("对方好象不愿意收下你的东西。\n");
if( obj->query("no_drop") )
return notify_fail("这样东西不能随便给人。\n");
if(no_give=obj->query("no_give") )
return notify_fail( stringp(no_give) ? no_give : "这样东西不能随意丢弃。\n");
//if( !interactive(who) && !who->accept_object(me, obj) )
// if (!who->accept_object(me,obj))
if (!userp(who)&&!who->accept_object(me,obj)) //china
return notify_fail("你只能把东西送给其他玩家操纵的人物。\n");
// if( !userp(who) && obj->value()) {
if( !userp(who) && !obj->is_character()) {
message_vision("$N拿出" + obj->short() + "给$n。\n", me, who);
destruct(obj);
return 1;
} else if( obj->move(who) ) {
示例2: do_give
int do_give(object me, object obj, object who) {
string str;
object your_item, *your_inv;
int j;
if(obj->query("no_drop")&& userp(who)) {
return notify_fail("这样东西不能随便给人。\n");
}
// not a good fix.. but a temperory one to fix making weapon/armor then give to NPCs.
if (obj->query("base_damage") || obj->query("base_armor"))
return notify_fail("这样东西不能随便给人。\n");
if ( obj->query("lore")) {
your_inv = all_inventory(who);
for(j=0;j<sizeof(your_inv);j++){
your_item = your_inv[j];
if(obj->query("name")==your_item->query("name")
&& your_item->query("lore"))
return notify_fail("这样东西他最多只能拥有一件。\n");
}
}
// check for dynamic_quests
if(obj->query("dynamic_quest") && TASK_D->quest_reward(me,who,obj)) {
return 1;
}
// check for flower delivery quests
if(obj->query("delivery") && QUESTS_D->flower_delivery_reward(me,who,obj)) {
return 1;
}
message_vision("$N递给$n一" + obj->query("unit") + obj->name() + "。\n", me, who);
if(!interactive(who)) {
if(!who->accept_object(me, obj)) {
str = query_notify_fail();
return notify_fail(str? str : who->name() + "并不要你的" + obj->name() + "。\n");
}
}
str = sprintf("(%s) \n%s(%s) give %s(%s) to %s(%s)\n", ctime(time()),
me->name(), userp(me)? me->query("id") : base_name(me),
obj->name(), base_name(obj),
who->name(), userp(who)? who->query("id") : base_name(who));
if(member_array(base_name(obj),files)!=-1)
log_file("GIVE_LOG", str);
if(!userp(who) && !who->query("can_carry")) {
// if(!userp(who)) {
destruct(obj);
} else if(!obj->move(who)) {
return 0;
}
// write(sprintf("记录是……%O\n",files));
// write(sprintf("当前物品是:%s\n",base_name(obj)));
// write(sprintf("是否是记录中的?%d\n",member_array(base_name(obj),files)));
// if ( wizardp(me) )log_file("GIVE_LOG", str);
return 1;
}
示例3: do_give
int do_give(object me, object obj, object who)
{
int is_accept;
object *inv;
mixed no_give;
if(me->is_busy())
return notify_fail("什么?\n");
if(who->is_busy())
return notify_fail("什么?\n");
if(who->query("env/no_accept"))
return notify_fail("什么?\n");
if(no_give=obj->query("no_give") )
return notify_fail( stringp(no_give) ? no_give : "什么?\n");
if( !interactive(who)) {
if (QUEST->quest_give (me, who, obj)) {
message_vision("$N给$n一"+obj->query("unit")+obj->name()+"。\n",me,who);
message_vision("$N由衷地向$n道谢。\n",who,me);
destruct(obj);
return 1;
}
if (TASK_D->quest_reward(me,who,obj)) {
message_vision("$N给$n一"+obj->query("unit")+obj->name()
+"。\n",me,who);
message_vision("$N由衷地向$n道谢。\n",who,me);
destruct(obj);
return 1;
}
if( !(is_accept=who->accept_object(me, obj)) )
return notify_fail("什么?\n");
if( is_accept == 2 )
return 1;
}
if( !userp(who) && obj->value() ) { // give money to npc
message_vision("$N拿出" + obj->short() + "给$n。\n", me, who);
destruct(obj);
return 2;
} else if( obj->move(who) ) {
示例4: do_give
int do_give(object me, object obj, object who) {
string str, name;
object your_item, *your_inv;
int j;
if(obj->query("no_drop")&& userp(who)) {
return notify_fail("�����������������ˡ�\n");
}
if (userp(who) && sizeof(all_inventory(who))>=26)
return notify_fail("�����Ѿ�����̫�ණ���ˣ�\n");
// not a good fix.. but a temperory one to fix making weapon/armor then give to NPCs.
if (obj->query("owner"))
return notify_fail("˽����Ʒ���������ˡ�\n");
if ( obj->query("lore")) {
your_inv = all_inventory(who);
for(j=0;j<sizeof(your_inv);j++){
your_item = your_inv[j];
if(obj->query("name")==your_item->query("name")
&& your_item->query("lore"))
return notify_fail("�������������ֻ��ӵ��һ����\n");
}
}
// check for dynamic_quests
if(obj->query("dynamic_quest") && TASK_D->quest_reward(me,who,obj)) {
return 1;
}
// check for flower delivery quests
if(obj->query("delivery") && QUESTS_D->flower_delivery_reward(me,who,obj)) {
return 1;
}
// check for perform reward
if(obj->query("pfm_r1") && F_ABILITY->pfm_r1_book_reward(me,who,obj)) {
return 1;
}
name = file_name(who);
message_vision("$N�ݸ�$nһ" + obj->query("unit") + obj->name() + "��\n", me, who);
if(!interactive(who)) {
if(!who->accept_object(me, obj)) {
str = query_notify_fail();
return notify_fail(str? str : who->name() + "����Ҫ���" + obj->name() + "��\n");
}
}
// A reminder here, don't destroy "who" in accept_object(). or it will cause error.
log_file("ERROR_DEBUG",sprintf("target %s is destroyed when executing give command.\n",name));
if(member_array(base_name(obj),files)!=-1) {
str = sprintf("(%s) \n%s(%s) give %s(%s) to %s(%s)\n", ctime(time()),
me->name(), userp(me)? me->query("id") : base_name(me),
obj->name(), base_name(obj),
who->name(), userp(who)? who->query("id") : base_name(who));
log_file("GIVE_LOG", str);
}
if(!userp(who) && !who->query("can_carry")) {
destruct(obj);
} else if(!obj->move(who)) {
return 0;
} else if (obj->query("no_transfer"))
obj->set("no_drop",1);
// write(sprintf("��¼�ǡ���%O\n",files));
// write(sprintf("��ǰ��Ʒ�ǣ�%s\n",base_name(obj)));
// write(sprintf("�Ƿ��Ǽ�¼�еģ�%d\n",member_array(base_name(obj),files)));
// if ( wizardp(me) )log_file("GIVE_LOG", str);
return 1;
}