本文整理汇总了C++中mixed::GetKeyName方法的典型用法代码示例。如果您正苦于以下问题:C++ mixed::GetKeyName方法的具体用法?C++ mixed::GetKeyName怎么用?C++ mixed::GetKeyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mixed
的用法示例。
在下文中一共展示了mixed::GetKeyName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckOrc
int CheckOrc(mixed val){
if(!val) return 0;
if(!objectp(val)) return 0;
if(val->GetRace() == "orc" || val->GetRace() == "rodent") return 0;
else eventForce("growl at "+val->GetKeyName());
return 1;
}
示例2: CheckOrc
int CheckOrc(mixed val){
if(!val) return 0;
if(!objectp(val)) return 0;
if(val->GetRace() == "orc" || val->GetRace() == "rodent") return 0;
eventForce("growl at "+val->GetKeyName());
eventForce("say murdering, genocidal humanoids! Leave us alone!");
return 1;
}
示例3: eventReceiveDamage
varargs int eventReceiveDamage(mixed agent, int type, int x, int internal, mixed limbs) {
int hp, damage, damdiff;
object ob = GetShadowedObject();
string evidence, limb_string;
evidence = "";
if(objectp(agent)) evidence += "You receive damage from "+agent->GetKeyName();
else if(stringp(agent)) evidence += "You receive damage from "+agent;
if(type) {
switch(type){
case BLUNT : evidence += ", damage type is BLUNT";break;
case BLADE : evidence += ", damage type is BLADE";break;
case KNIFE : evidence += ", damage type is KNIFE";break;
case WATER : evidence += ", damage type is WATER";break;
case SHOCK : evidence += ", damage type is SHOCK";break;
case COLD : evidence += ", damage type is COLD";break;
case HEAT : evidence += ", damage type is HEAT";break;
case GAS : evidence += ", damage type is GAS";break;
case ACID : evidence += ", damage type is ACID";break;
case MAGIC : evidence += ", damage type is MAGIC";break;
case POISON : evidence += ", damage type is POISON";break;
case DISEASE : evidence += ", damage type is DISEASE";break;
case TRAUMA : evidence += ", damage type is TRAUMA";break;
case PIERCE : evidence += ", damage type is PIERCE";break;
case PSIONIC : evidence += ", damage type is PSIONIC";break;
case ANOXIA : evidence += ", damage type is ANOXIA";break;
case DEATHRAY : evidence += ", damage type is DEATHRAY";break;
case EMOTIONAL : evidence += ", damage type is EMOTIONAL";break;
case SONIC : evidence += ", damage type is SONIC";break;
case BITE : evidence += ", damage type is BITE";break;
case OTHER : evidence += ", damage type is OTHER";break;
default : evidence += ", damage type is UNKNOWN";break;
}
}
if(x) evidence += ", raw damage is "+x;
if(internal) evidence += ", internal variable is "+internal;
if(limbs) {
if(stringp(limbs)) limb_string = limbs;
else if(arrayp(limbs)) {
if(stringp(limbs[0])) limb_string = implode(limbs,", ");
else if(objectp(limbs[0])){
foreach(object limb in limbs){
limb_string += limb->GetKeyName()+", ";
}
}
}
}
示例4: MarriageRequest
int MarriageRequest(mixed arg1, mixed arg2, mixed arg3){
string s1, s2, dudename;
object ob1, ob2;
if(strsrch(arg2,"divorce") != -1){
this_object()->performDivorce(arg1);
return 1;
}
if(sscanf(arg3,"%s and %s", s1, s2) !=2 &&
sscanf(arg3,"%s to %s", s1, s2) !=2){
eventForce("say "+arg1->GetName()+", you are confusing me.");
return 1;
}
dudename = arg1->GetKeyName();
if(s1 == "me" || s1 == "i") s1 = dudename;
if(s2 == "me" || s2 == "i") s2 = dudename;
if(s1 != dudename && s2 != dudename ){
eventForce("say Those people will have to decide "+
"to get married on their own. It isn't "+
"any of your business.");
return 1;
}
if( s1 == s2){
eventForce("say we don't do single-member marriages here.");
return 1;
}
if(! ob1 = present(s1, environment(this_object()))){
eventForce("say "+capitalize(s1)+" isn't here.");
return 1;
}
if(! ob2 = present(s2, environment(this_object()))){
eventForce("say "+capitalize(s2)+" isn't here.");
return 1;
}
if(!living(ob1) || !living(ob2)){
eventForce("say I do not perform marriages with inanimate objects.");
return 1;
}
this_object()->performMarriage(ob1, ob2);
return 1;
}
示例5: eventReceiveDamage
varargs int eventReceiveDamage(mixed agent, int type, int x, int internal, mixed limbs) {
int stamina, fatigue, hp, damage, damdiff;
object ob = GetShadowedObject();
string evidence, limb_string;
if(reporting){
string *damtypes = TYPES_D->eventCalculateTypes("damage", type);
evidence = "%^BOLD%^%^RED%^";
if(objectp(agent)) evidence += "You receive damage from "+agent->GetKeyName();
else if(stringp(agent)) evidence += "You receive damage from "+agent;
evidence +=".";
if(type && sizeof(damtypes)) {
string verboid;
if(sizeof(damtypes) > 1) verboid = "s are ";
else verboid = " is ";
evidence += " Damage type"+verboid;
evidence += lower_case(implode(damtypes,", "));
}
else evidence += " Damage type is UNKNOWN";
if(x) evidence += ", raw damage is "+x;
if(internal) evidence += ", internal variable is "+internal;
if(limbs) {
if(stringp(limbs)) limb_string = limbs;
else if(arrayp(limbs)) {
if(stringp(limbs[0])) limb_string = implode(limbs,", ");
else if(objectp(limbs[0])){
foreach(object limb in limbs){
limb_string += limb->GetKeyName()+", ";
}
}
}
}
else limb_string = ", and you can't tell where you're hit. ";
示例6: make_workroom
varargs int make_workroom(mixed dude, int cre) {
string tdir, dir_line, bakdata;
int creator;
if(!dude) return 0;
if(objectp(dude)){
cdir = homedir(dude, cre);
creator = (cre || creatorp(dude));
if(sizeof(get_dir(REALMS_DIRS+"/")) ==1) creator = 1;
nom = dude->GetKeyName();
}
if(stringp(dude)){
dude = lower_case(dude);
if(cre || member_array(dude, PLAYERS_D->GetCreatorList()) != -1){
creator = 1;
cdir = REALMS_DIRS + "/" + dude;
}
else {
cdir = ESTATES_DIRS + "/" + dude[0..0] + "/" + dude;
}
nom = dude;
}
if(unguarded( (: file_size("/realms/template/") :) ) == -1) return 4;
if(unguarded( (: file_size(cdir+"/area") :) ) == -1){
tdir = "/realms/template/";
dir_line = "#define MY_DIR \""+cdir+"\"";
bakdata = "workroom.orig : "+cdir+"/workroom.c\n";
mkdir(cdir);
mkdir(cdir+"/log");
mkdir(cdir+"/log/archive");
mkdir(cdir+"/bak");
mkdir(cdir+"/tmp");
mkdir(cdir+"/area");
mkdir(cdir+"/adm");
mkdir(cdir+"/area/room");
mkdir(cdir+"/area/save");
mkdir(cdir+"/area/weap");
mkdir(cdir+"/area/obj");
mkdir(cdir+"/area/npc");
mkdir(cdir+"/area/armor");
mkdir(cdir+"/area/etc");
mkdir(cdir+"/area/doors");
mkdir(cdir+"/area/meals");
if(creator){
mkdir(cdir+"/cmds");
mkdir(cdir+"/public_html");
cp(tdir+"plan", cdir+"/.plan");
cp(tdir+"evaldefs.h", cdir+"/evaldefs.h");
cp(tdir+"profile", cdir+"/.profile");
cp(tdir+"cmds/custom.c", cdir+"/cmds/custom.c");
cp(tdir+"workroom.c", cdir+"/workroom.c");
cp(tdir+"workroom.c", cdir+"/workroom.bak");
cp(tdir+"workroom.c", cdir+"/bak/workroom.orig");
cp(tdir+"area/obj/chest.c", cdir+"/area/obj/chest.c");
}
else {
cp(tdir+"workroom_builder.c", cdir+"/workroom.c");
cp(tdir+"workroom_builder.c", cdir+"/workroom.bak");
cp(tdir+"workroom_builder.c", cdir+"/bak/workroom.orig");
cp(tdir+"area/obj/builder_chest.c", cdir+"/area/obj/builder_chest.c");
}
cp(tdir+"adm/remote.c",cdir+"/adm/remote.c");
write_file(cdir+"/bak/bk.db",bakdata);
cp(tdir+"area/customdefs.part1", cdir+"/area/customdefs.h");
write_file(cdir+"/area/customdefs.h","\n"+dir_line+"\n");
write_file(cdir+"/area/customdefs.h",read_file(tdir+"area/customdefs.part2"));
cp(tdir+"area/room/sample_room.c", cdir+"/area/room/sample_room.c");
cp(tdir+"area/room/sample_two.c", cdir+"/area/room/sample_two.c");
cp(tdir+"area/weap/sword.c", cdir+"/area/weap/sword.c");
cp(tdir+"area/obj/table.c", cdir+"/area/obj/table.c");
cp(tdir+"area/obj/key.c", cdir+"/area/obj/key.c");
cp(tdir+"area/obj/case.c", cdir+"/area/obj/case.c");
cp(tdir+"area/obj/cup.c", cdir+"/area/obj/cup.c");
cp(tdir+"area/obj/pitcher.c", cdir+"/area/obj/pitcher.c");
cp(tdir+"area/obj/watch.c", cdir+"/area/obj/watch.c");
cp(tdir+"area/npc/fighter.c", cdir+"/area/npc/fighter.c");
cp(tdir+"area/armor/chainmail.c", cdir+"/area/armor/chainmail.c");
cp(tdir+"area/armor/leather_boot_r.c", cdir+"/area/armor/leather_boot_r.c");
cp(tdir+"area/armor/leather_boot_l.c", cdir+"/area/armor/leather_boot_l.c");
return 1;
}
else {
//write("That person already has a homedir.");
return 5;