本文整理汇总了C++中object::GetKeyName方法的典型用法代码示例。如果您正苦于以下问题:C++ object::GetKeyName方法的具体用法?C++ object::GetKeyName怎么用?C++ object::GetKeyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::GetKeyName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_resurrect_obj
mixed do_resurrect_obj(object ob) {
int corpse;
object playerob;
if(ob->isCorpse()) corpse = 1;
if(interactive(ob)) playerob = ob;
if( ob->isPlayer() ) playerob = ob->GetPlayerob();
if( ob->isPlayer() && !playerob ){
write("You cannot resurrect a player that isn't logged on.");
return 1;
}
if((playerob && !playerob->GetGhost()) || living(ob)) {
write("You can't resurrect the living.");
return 1;
}
if(base_name(ob) != LIB_CORPSE){
write("You can only resurrect flesh-based creatures.");
return 1;
}
if(environment(ob) != environment(this_player())) {
write(capitalize(ob->GetKeyName())+" isn't here.");
return 1;
}
tell_player(this_player(),"You wave your hand, and with a flash "+
"of light, "+ob->GetCapName()+" comes back to life!");
tell_player(ob,capitalize(this_player()->GetKeyName())+" waves "+
possessive(this_player())+
" hand, and with a flash of light, you come back from the dead!");
tell_room(environment(this_player()),this_player()->GetCapName()+" waves "+
possessive(this_player())+
" hand, and with a flash of light, "+ob->GetCapName()+
" comes back to life!",
({ob, this_player()}) );
示例2: CheckNPC
/*Do not attack other NPC's*/
void CheckNPC(object ob){
object env=environment(this_object());
if(ob && !inherits(LIB_NPC, ob)){
eventForce("kill " +ob->GetKeyName());
}
}
示例3: performDivorce
int performDivorce(object ob1){
string spouse1, spouse2;
object ring1, ring2, ob2;
spouse1 = ob1->GetKeyName();
if(!ob1->GetSpouse()){
eventForce("say You don't appear to be married.");
return 1;
}
spouse2 = lower_case(ob1->GetSpouse());
ob2 = find_player(spouse2);
if(!ob1->CanDivorce(ob1)){
eventForce("say I cannot perform this divorce. Are you sure "+
"you are still married?");
return 1;
}
if(!find_player(spouse1) || !ob1 ){
eventForce("say I'm sorry. Both spouses must be logged "+
"on for a divorce to take place.");
return 1;
}
ob1->eventDivorce(ob1);
ob2->eventDivorce(ob2);
ring1 = present("official wedding ring",ob1);
ring2 = present("official wedding ring",ob2);
if(ring1) ring1->eventDestruct();
if(ring2) ring2->eventDestruct();
eventForce("say The divorce is complete.");
tell_player(spouse1,"%^RED%^You are now divorced from "+capitalize(spouse2)+"%^RESET%^!");
tell_player(spouse2,"%^RED%^You are now divorced from "+capitalize(spouse1)+"%^RESET%^!");
eventForce("shout this office duly records and announces that "+capitalize(spouse1) +" has divorced "+capitalize(spouse2)+"!");
return 1;
}