#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "merc.h"
#include "interp.h"
Include dependency graph for act_enter.c:

Go to the source code of this file.
Functions | |
| void | do_enter (CHAR_DATA *ch, char *argument) |
| ROOM_INDEX_DATA * | get_random_room (CHAR_DATA *ch) |
|
||||||||||||
|
Definition at line 66 of file act_enter.c. References char_data::act, act, ACT_AGGRESSIVE, AFF_CHARM, AFF_CURSE, ANGEL, can_see_room(), char_from_room(), char_to_room(), do_enter(), do_function(), do_look(), do_stand(), EX_CLOSED, extract_obj(), GATE_BUGGY, GATE_GOWITH, GATE_NOCURSE, GATE_NORMAL_EXIT, GATE_RANDOM, get_obj_list(), get_random_room(), get_room_index(), HAS_TRIGGER, IMPLEMENTOR, IS_AFFECTED, IS_NPC, IS_SET, IS_TRUSTED, ITEM_PORTAL, obj_data::item_type, char_data::master, mp_greet_trigger(), mp_percent_trigger(), char_data::next_in_room, number_percent(), obj_from_room(), obj_to_room(), room_index_data::people, POS_STANDING, char_data::position, room_index_data::room_flags, room_is_private(), ROOM_LAW, ROOM_NO_RECALL, send_to_char(), TO_CHAR, TO_ROOM, TRIG_ENTRY, obj_data::value, and room_index_data::vnum. Referenced by do_enter(). 00067 {
00068 ROOM_INDEX_DATA *location;
00069
00070 if (ch->fighting != NULL)
00071 return;
00072
00073 /* nifty portal stuff */
00074 if (argument[0] != '\0')
00075 {
00076 ROOM_INDEX_DATA *old_room;
00077 OBJ_DATA *portal;
00078 CHAR_DATA *fch, *fch_next;
00079
00080 old_room = ch->in_room;
00081
00082 portal = get_obj_list (ch, argument, ch->in_room->contents);
00083
00084 if (portal == NULL)
00085 {
00086 send_to_char ("You don't see that here.\n\r", ch);
00087 return;
00088 }
00089
00090 if (portal->item_type != ITEM_PORTAL
00091 || (IS_SET (portal->value[1], EX_CLOSED)
00092 && !IS_TRUSTED (ch, ANGEL)))
00093 {
00094 send_to_char ("You can't seem to find a way in.\n\r", ch);
00095 return;
00096 }
00097
00098 if (!IS_TRUSTED (ch, ANGEL)
00099 && !IS_SET (portal->value[2], GATE_NOCURSE)
00100 && (IS_AFFECTED (ch, AFF_CURSE)
00101 || IS_SET (old_room->room_flags, ROOM_NO_RECALL)))
00102 {
00103 send_to_char ("Something prevents you from leaving...\n\r", ch);
00104 return;
00105 }
00106
00107 if (IS_SET (portal->value[2], GATE_RANDOM) || portal->value[3] == -1)
00108 {
00109 location = get_random_room (ch);
00110 portal->value[3] = location->vnum; /* for record keeping :) */
00111 }
00112 else if (IS_SET (portal->value[2], GATE_BUGGY)
00113 && (number_percent () < 5)) location = get_random_room (ch);
00114 else
00115 location = get_room_index (portal->value[3]);
00116
00117 if (location == NULL
00118 || location == old_room
00119 || !can_see_room (ch, location)
00120 || (room_is_private (location) && !IS_TRUSTED (ch, IMPLEMENTOR)))
00121 {
00122 act ("$p doesn't seem to go anywhere.", ch, portal, NULL,
00123 TO_CHAR);
00124 return;
00125 }
00126
00127 if (IS_NPC (ch) && IS_SET (ch->act, ACT_AGGRESSIVE)
00128 && IS_SET (location->room_flags, ROOM_LAW))
00129 {
00130 send_to_char ("Something prevents you from leaving...\n\r", ch);
00131 return;
00132 }
00133
00134 act ("$n steps into $p.", ch, portal, NULL, TO_ROOM);
00135
00136 if (IS_SET (portal->value[2], GATE_NORMAL_EXIT))
00137 act ("You enter $p.", ch, portal, NULL, TO_CHAR);
00138 else
00139 act ("You walk through $p and find yourself somewhere else...",
00140 ch, portal, NULL, TO_CHAR);
00141
00142 char_from_room (ch);
00143 char_to_room (ch, location);
00144
00145 if (IS_SET (portal->value[2], GATE_GOWITH))
00146 { /* take the gate along */
00147 obj_from_room (portal);
00148 obj_to_room (portal, location);
00149 }
00150
00151 if (IS_SET (portal->value[2], GATE_NORMAL_EXIT))
00152 act ("$n has arrived.", ch, portal, NULL, TO_ROOM);
00153 else
00154 act ("$n has arrived through $p.", ch, portal, NULL, TO_ROOM);
00155
00156 do_function (ch, &do_look, "auto");
00157
00158 /* charges */
00159 if (portal->value[0] > 0)
00160 {
00161 portal->value[0]--;
00162 if (portal->value[0] == 0)
00163 portal->value[0] = -1;
00164 }
00165
00166 /* protect against circular follows */
00167 if (old_room == location)
00168 return;
00169
00170 for (fch = old_room->people; fch != NULL; fch = fch_next)
00171 {
00172 fch_next = fch->next_in_room;
00173
00174 if (portal == NULL || portal->value[0] == -1)
00175 /* no following through dead portals */
00176 continue;
00177
00178 if (fch->master == ch && IS_AFFECTED (fch, AFF_CHARM)
00179 && fch->position < POS_STANDING)
00180 do_function (fch, &do_stand, "");
00181
00182 if (fch->master == ch && fch->position == POS_STANDING)
00183 {
00184
00185 if (IS_SET (ch->in_room->room_flags, ROOM_LAW)
00186 && (IS_NPC (fch) && IS_SET (fch->act, ACT_AGGRESSIVE)))
00187 {
00188 act ("You can't bring $N into the city.",
00189 ch, NULL, fch, TO_CHAR);
00190 act ("You aren't allowed in the city.",
00191 fch, NULL, NULL, TO_CHAR);
00192 continue;
00193 }
00194
00195 act ("You follow $N.", fch, NULL, ch, TO_CHAR);
00196 do_function (fch, &do_enter, argument);
00197 }
00198 }
00199
00200 if (portal != NULL && portal->value[0] == -1)
00201 {
00202 act ("$p fades out of existence.", ch, portal, NULL, TO_CHAR);
00203 if (ch->in_room == old_room)
00204 act ("$p fades out of existence.", ch, portal, NULL, TO_ROOM);
00205 else if (old_room->people != NULL)
00206 {
00207 act ("$p fades out of existence.",
00208 old_room->people, portal, NULL, TO_CHAR);
00209 act ("$p fades out of existence.",
00210 old_room->people, portal, NULL, TO_ROOM);
00211 }
00212 extract_obj (portal);
00213 }
00214
00215 /*
00216 * If someone is following the char, these triggers get activated
00217 * for the followers before the char, but it's safer this way...
00218 */
00219 if (IS_NPC (ch) && HAS_TRIGGER (ch, TRIG_ENTRY))
00220 mp_percent_trigger (ch, NULL, NULL, NULL, TRIG_ENTRY);
00221 if (!IS_NPC (ch))
00222 mp_greet_trigger (ch);
00223
00224 return;
00225 }
00226
00227 send_to_char ("Nope, can't do it.\n\r", ch);
00228 return;
00229 }
|
Here is the call graph for this function:

|
|
Definition at line 44 of file act_enter.c. References ACT_AGGRESSIVE, can_see_room(), get_room_index(), IS_NPC, IS_SET, number_range(), room_is_private(), ROOM_LAW, ROOM_PRIVATE, ROOM_SAFE, and ROOM_SOLITARY. Referenced by do_enter(), and spell_teleport(). 00045 {
00046 ROOM_INDEX_DATA *room;
00047
00048 for (;;)
00049 {
00050 room = get_room_index (number_range (0, 65535));
00051 if (room != NULL)
00052 if (can_see_room (ch, room)
00053 && !room_is_private (room)
00054 && !IS_SET (room->room_flags, ROOM_PRIVATE)
00055 && !IS_SET (room->room_flags, ROOM_SOLITARY)
00056 && !IS_SET (room->room_flags, ROOM_SAFE)
00057 && (IS_NPC (ch) || IS_SET (ch->act, ACT_AGGRESSIVE)
00058 || !IS_SET (room->room_flags, ROOM_LAW)))
00059 break;
00060 }
00061
00062 return room;
00063 }
|
Here is the call graph for this function:

1.4.0