Skip to content

Commit 847a739

Browse files
committed
Fix for issue #434
1 parent 5aafdc8 commit 847a739

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

_datafiles/world/default/mobs/frostfang/scripts/2-guard-hungry.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,38 +86,34 @@ function onIdle(mob, room) {
8686
round = UtilGetRoundNumber();
8787

8888
grumbled = false;
89-
userIds = room.GetPlayers();
89+
allPlayers = room.GetPlayers();
9090

9191
playersTold = mob.GetTempData('playersTold');
9292
if ( playersTold === null ) {
9393
playersTold = {};
9494
}
9595

96-
if ( userIds.length > 0 ) {
96+
if ( allPlayers.length > 0 ) {
9797

98-
for (var i = 0; i < userIds.length; i++) {
98+
for( var i in allPlayers ) {
9999

100-
if ( userIds[i] in playersTold ) {
101-
if ( round < playersTold[userIds[i]] ) {
100+
if ( allPlayers[i].UserId() in playersTold ) {
101+
if ( round < playersTold[allPlayers[i].UserId()] ) {
102102
continue;
103103
}
104104
}
105-
106-
if ( (user = GetUser(userIds[i])) == null ) {
107-
continue;
108-
}
109-
110-
if ( !user.HasQuest("4-start") ) {
105+
106+
if ( !allPlayers[i].HasQuest("4-start") ) {
111107
if ( !grumbled ) {
112108
mob.Command("emote pats his belly as it grumbles.");
113109
grumbled = true;
114110
}
115-
mob.Command("sayto @" + String(userIds[i]) + " I'm so hungry.");
111+
mob.Command("sayto @" + String(allPlayers[i].UserId()) + " I'm so hungry.");
116112
} else {
117-
playersTold[userIds[i]] = round + 500;
113+
playersTold[allPlayers[i].UserId()] = round + 500;
118114
}
119115

120-
playersTold[userIds[i]] = round + 5;
116+
playersTold[allPlayers[i].UserId()] = round + 5;
121117
// Don't need to repeat to every player.
122118
break;
123119
}

_datafiles/world/default/rooms/catacombs/136.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ function onCommand(cmd, rest, user, room) {
2121

2222

2323
players = room.GetPlayers();
24-
for (var i = 0; i < players.length; i++) {
25-
if ( (user = GetUser(players[i])) !== null ) {
26-
SendRoomMessage(138, user.GetCharacterName(true)+" falls into the room from above.", user.UserId());
27-
user.MoveRoom(138);
28-
}
24+
for( var i in players ) {
25+
SendRoomMessage(138, players[i].GetCharacterName(true)+" falls into the room from above.", players[i].UserId());
26+
players[i].MoveRoom(138);
2927
}
3028

3129
return true;

0 commit comments

Comments
 (0)