void trap_teleport(struct char_data *v) { int to_room; extern int top_of_world; /* ref to the top element of world */ if (saves_spell(v, SAVING_SPELL)) { send_to_char("You feel strange, but the effect fades.\n\r", v); return; } do { to_room = number(0, top_of_world); } while (IS_SET(real_roomp(to_room)->room_flags, PRIVATE)); act("$n slowly fade out of existence.", FALSE, v, 0, 0, TO_ROOM); char_from_room(v); char_to_room(v, to_room); act("$n slowly fade in to existence.", FALSE, v, 0, 0, TO_ROOM); look_room(v); if (IS_SET(real_roomp(to_room)->room_flags, DEATH) && get_max_level(v) < LOW_IMMORTAL) { nail_this_sucker(v); } }
void CHSInterface::LookInRoom(HS_DBREF dbPlayer, HS_DBREF dbRoom, HS_INT32 iHow) { #ifdef PENNMUSH NEW_PE_INFO *pe_info = make_pe_info("pe_info-HSpace_look_in_room"); look_room(dbPlayer, dbRoom, (HS_LOOK_TYPE) iHow, pe_info); #endif #if defined(TM3) || defined(MUX) look_in(dbPlayer, dbRoom, iHow); #endif }
int main(object me, string arg) { object obj; int result; if( !arg ) result = look_room(me, environment(me)); else if( (obj = present(arg, me)) || (obj = present(arg, environment(me)))) { if( obj->is_character() ) result = look_living(me, obj); else result = look_item(me, obj); } else result = look_room_item(me, arg); return result; }
static void exec_action(int op,int arg1,int arg2) { int i, j; char *tmpstr; switch(op) { case 1000:goto_room(arg1-first_room);break; case 1001:goto_room(agt_rand(arg1,arg2)-first_room);break; case 1002:agt_var[arg1]=loc+first_room;break; case 1003:agt_var[arg1]=dobj;break; case 1004:agt_var[arg1]=iobj;break; case 1005:goto_room(agt_var[arg1]-first_room);break; case 1006:it_move(arg1,agt_var[arg2]);break; case 1007:get_obj(agt_var[arg1]);break; case 1008:msgout(agt_var[arg1],1);break; case 1009:get_obj(arg1);break; case 1010:get_obj(arg1);it_move(arg1,1000);break; case 1011:drop_obj(arg1);break; case 1012: if (it_loc(arg1)==1000) { if (PURE_WEAR) drop_obj(arg1); else it_move(arg1,1); } break; case 1013:fontcmd(0,arg1-1);break; /* Load font */ case 1014:pictcmd(1,pictable[arg1-1]);break; /* Show picture */ case 1015:changepict(arg1,arg2);break; /* ChangePicture */ case 1016: if (PICT_SUPPORT && yesno("Would you like to see the picture?")) pictcmd(1,pictable[arg1-1]);break; case 1017:pictcmd(2,arg1);break; /* Show room pix */ case 1018: if (PICT_SUPPORT && yesno("Would you like to see the picture?")) pictcmd(2,arg1-1);break; case 1019:musiccmd(1,arg1-1);break; case 1020:musiccmd(1,agt_rand(arg1,arg2)-1);break; case 1021:musiccmd(2,arg1-1);break; case 1022:musiccmd(3,-1); break; /* Stop Repeat */ case 1023:musiccmd(4,-1); break; /* Stop song */ case 1024:musiccmd(5,-1); break; /* Suspend song */ case 1025:musiccmd(6,-1);break; /* Resume song */ case 1026: if (tnoun(dobj)) noun[dobj-first_noun].movable=!noun[dobj-first_noun].movable; break; case 1027: it_newdesc(arg1,&msg_ptr[arg2-1]); break; case 1028: if (tnoun(arg1)) noun[arg1-first_noun].points=arg2; else if (tcreat(arg1)) creature[arg1-first_creat].points=arg2; else if (troom(arg1)) room[arg1-first_room].points=arg2; break; case 1029:it_destroy(iobj);break; case 1030: tmpstr=agt_readline(3); i=strlen(tmpstr)-1; if (i>0 && tmpstr[i]=='\n') tmpstr[i]=0; strncpy(userstr[arg1-1],tmpstr,80); rfree(tmpstr); break; case 1031:agt_var[arg1]=read_number();break; case 1032:agt_var[arg1]=curr_time;break; case 1033:curr_time=normalize_time(agt_var[arg1]);break; case 1034:curr_time=normalize_time(arg1); break; case 1035:add_time(arg1);break; case 1036:delta_time=arg1;break; /* 1037 and 1038 are subroutine commands */ case 1039:get_obj(dobj);break; case 1040:it_move(dobj,1000);break; case 1041:drop_obj(dobj);break; case 1042: if (it_loc(dobj)==1000) { if (PURE_WEAR) it_move(dobj,1); else drop_obj(dobj); } break; case 1043: /* drop all */ safecontloop(i,j,1) drop_obj(i); break; case 1044: /* remove all */ safecontloop(i,j,1000) drop_obj(i); break; case 1045:deadflag=1;break; case 1046:it_move(arg1,loc+first_room);break; case 1047:it_move(arg1,arg2);break; case 1048:it_reposition(arg1,arg2,1);break; /* RePosition */ case 1049:it_move(dobj,loc+first_room);break; case 1050:it_move(dobj,arg1);break; case 1051: safecontloop(i,j,1) it_move(i,arg1); safecontloop(i,j,1000) it_move(i,arg1); break; case 1052: nounloop(i) if (player_has(i+first_noun) && noun[i].points>arg2) it_move(i+first_noun,arg1); break; case 1053: safecontloop(i,j,arg1) if (tnoun(i)) it_move(i,arg2); break; case 1054:it_destroy(arg1);break; case 1055:it_destroy(dobj);break; case 1056:i=it_loc(arg1); it_move(arg1,it_loc(arg2)); it_move(arg2,i); break; case 1057:it_move(arg1,it_loc(arg2));break; case 1058:it_move(dobj,it_loc(arg2));break; case 1059: case 1060: /* Add to/remove from group */ if (tcreat(arg1)) creature[arg1-first_creat].groupmemb=(op==1059); break; case 1061: /* Move group */ safecontloop(i,j,loc+first_room) if (it_group(i)) it_move(i,arg1); break; /* 1062 is RedirectTo */ case 1063:msgout(agt_rand(arg1,arg2),1);break; case 1064:print_contents(arg1,1);break; case 1065: case 1066: case 1067: case 1068: obj_act(op-1065,arg1);break; case 1069: case 1070: case 1071: case 1072: obj_act(op-1069,dobj);break; case 1073:print_score();break; case 1074: tscore+=arg1;break; case 1075: tscore-=arg1;break; case 1076:v_inventory();break; case 1077:wait_return();break; case 1078:writeln("Time passes...");break; case 1079:agt_delay(arg1);break; case 1080:agt_clrscr();break; case 1081:it_describe(arg1);break; case 1082:look_room();break; /* LOOK */ case 1083:msgout(arg1,1);break; case 1084:writeln("");break; case 1085:if (PURE_TONE && sound_on) agt_tone(arg1,arg2);break; /* Tone */ case 1086:agt_number=ask_for_number(arg1,arg2);break; case 1087:agt_answer=ask_question(arg1);break; case 1088:change_passage(loc,arg1,arg2);break; case 1089:flag[arg1]=1;break; case 1090:flag[arg1]=0;break; case 1091:flag[arg1]=!flag[arg1];break; case 1092:room[loc].flag_noun_bits|=(1 << (arg1-1) ); break; /* Roomflag on */ case 1093:room[loc].flag_noun_bits&=~(1 << (arg1-1) );break; /* Off */ case 1094:room[loc].flag_noun_bits^=(1 << (arg1-1) );break; /* Toggle */ case 1095: /* if (agt_counter[arg1]==-1)*/ agt_counter[arg1]=1;break; case 1096:agt_counter[arg1]=-1;break; case 1097:agt_var[arg1]=arg2;break; case 1098:agt_var[arg1]+=arg2;break; case 1099:agt_var[arg1]-=arg2;break; case 1100:agt_var[arg1]+=agt_var[arg2];break; case 1101:agt_var[arg1]-=agt_var[arg2];break; case 1102:agt_var[arg1]=agt_rand(0,arg2);break; case 1103:agt_var[arg1]=dobj_rec->num;break; case 1104:agt_var[arg1]=iobj_rec->num;break; /* The following are v1.8x specific */ case 1105:quote(arg1);break; case 1106:add_time(arg1);break; case 1107:add_time(-arg1);break; case 1108:curr_time=(curr_time%100)+100*arg1;break; case 1109:curr_time=(curr_time/100)*100+arg1;break; case 1110:add_time(agt_var[arg1]);break; case 1111:add_time(-agt_var[arg1]);break; case 1112:curr_time=(curr_time%100)+100*agt_var[arg1];break; case 1113:curr_time=(curr_time/100)*100+agt_var[arg1];break; /* Now for the AGX additions */ case 1114:add_time(-arg1);break; /* ME-style SubtractFromTime */ case 1115: disambig_score=arg1; break; /* SetDisambigPriority */ case 1116:agt_var[arg1]=delta_time;break; case 1117: /* ChangeStatus */ statusmode=arg1; break; case 1118: if (!mult_rangecheck(agt_var[arg1],arg2)) break; agt_var[arg1]*=arg2;break; case 1119: if (arg2==0) { if (!PURE_ERROR) writeln("GAME ERROR: Division by zero."); } else agt_var[arg1]/=arg2; break; case 1120: if (arg2==0) { if (!PURE_ERROR) writeln("GAME ERROR: Attempt to divide by zero."); } else agt_var[arg1]%=arg2; break; case 1121:agt_waitkey();break; case 1122:last_he=arg1;break; /* SetHE */ case 1123:last_she=arg1;break; case 1124:last_it=arg1;break; case 1125:last_they=arg1;break; case 1126:msgout(arg1,0);break; case 1127: if (!PURE_ERROR) sysmsg(arg1,"GAME ERROR: Standard message not defined."); break; case 1128: msgout(arg1,1);break; /* FailMessage */ case 1129: /* StdMessage */ sysmsg(arg1,"GAME ERROR: Standard message not defined."); break; case 1130: msgout(arg2,1);break; /* ErrMessage */ case 1131: /* StdErrMessage */ sysmsg(arg1,"GAME ERROR: Standard message not defined."); break; case 1132: /* AND */ break; /* These don't do anything under normal circumstances */ case 1133: /* SetClass */ if (troom(arg1)) room[arg1-first_room].oclass=arg2; else if (tnoun(arg1)) noun[arg1-first_noun].oclass=arg2; else if (tcreat(arg1)) noun[arg1-first_creat].oclass=arg2; break; case 1134: agt_var[arg1]=it_class(arg2); break; /* SetVariableToClass */ /* Stack commands */ case 1135: push_stack(arg1); break; case 1136: agt_var[arg1]=pop_stack(); break; case 1137: case 1138: case 1139: case 1140: case 1141: op_stack(op-1137); /* +,-,*, /,% * */ break; case 1142: { /* DupStack */ long n; n=pop_stack(); push_stack(n); push_stack(n); break; } case 1143: pop_stack();break; /* Discard TOS */ case 1144: agt_var[arg1]=agt_number;break; /* SetVariableToInput */ case 1145: setattr(arg1,arg2,1); break; /* Set */ case 1146: setattr(arg1,arg2,0); break; /* Clear */ case 1147: push_stack(getprop(arg1,arg2));break; /* PushProp */ case 1148: setprop(arg1,arg2,pop_stack());break; /* PopProp */ /* 1149, 1150 handled by run_metacommand */ /* 1151 is EndDisambig */ /* 1152 is XRedirect */ case 1153: rstrncpy(userstr[arg1-1],userstr[arg2-1],81);break; case 1154: setcase(userstr[arg1-1],1); break; case 1155: setcase(userstr[arg1-1],0);break; case 1156: op_objflag(1,arg1,arg2);break; case 1157: op_objflag(0,arg1,arg2);break; case 1158: op_objflag(3,arg1,arg2);break; case 1159: push_stack(op_objprop(2,arg1,arg2,0)); break; case 1160: op_objprop(1,arg1,arg2,pop_stack()); break; case 1161: move_in_dir(arg1,arg2); break; default: writeln("INTERNAL ERROR: Action token not supported."); rprintf("Action #%d",op); writeln(""); } }
void stand(struct char_data *ch, struct gameobject *on) { // TODO - need to extract can_get_obj from get_obj // Impassible positions. switch (ch->position) { case POS_STANDING: if (on == NULL || on == ch->on) { send_to_char("You are already standing.\n\r", ch); return; } break; case POS_FIGHTING: send_to_char("Maybe you should finish this fight first?\n\r", ch); return; case POS_SLEEPING: if (IS_AFFECTED(ch, AFF_SLEEP)) { send_to_char("You can't wake up!\n\r", ch); return; } break; } // Validate target object, if any. if (on != NULL) { if (!is_standupon(on)) { send_to_char("You can't seem to find a place to stand.\n\r", ch); return; } if (ch->on != on && (long)count_users(on) >= on->value[0]) { act_new("There's no room to stand on $p.", ch, on, NULL, TO_ROOM, POS_DEAD, false); return; } // TODO check if object is gettable } // stand up, possibly on something. ch->position = POS_STANDING; if (on != ch->on) { struct gameobject *old_on = ch->on; ch->on = on; if (old_on != NULL && can_see_obj(ch, old_on)) { // TODO - only if object is gettable. get_obj(ch, old_on, NULL); } } // Notify. switch (ch->position) { default: if (on == NULL) { send_to_char("You stand up.\n\r", ch); act("$n stands up.", ch, NULL, NULL, TO_ROOM); } else if (IS_SET(on->value[2], STAND_AT)) { act("You stand at $p.", ch, on, NULL, TO_CHAR); act("$n stands at $p.", ch, on, NULL, TO_ROOM); } else if (IS_SET(on->value[2], STAND_ON)) { act("You stand on $p.", ch, on, NULL, TO_CHAR); act("$n stands on $p.", ch, on, NULL, TO_ROOM); } else { act("You stand in $p.", ch, on, NULL, TO_CHAR); act("$n stands on $p.", ch, on, NULL, TO_ROOM); } break; case POS_SLEEPING: if (on == NULL) { send_to_char("You wake and stand up.\n\r", ch); act("$n wakes and stands up.", ch, NULL, NULL, TO_ROOM); } else if (IS_SET(on->value[2], STAND_AT)) { act_new("You wake and stand at $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false); act("$n wakes and stands at $p.", ch, on, NULL, TO_ROOM); } else if (IS_SET(on->value[2], STAND_ON)) { act_new("You wake and stand on $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false); act("$n wakes and stands on $p.", ch, on, NULL, TO_ROOM); } else { act_new("You wake and stand in $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false); act("$n wakes and stands in $p.", ch, on, NULL, TO_ROOM); } look_room(ch, ch->in_room); break; } }