MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / MissingQuest

Method MissingQuest

internal/scripting/room_func.go:404–444  ·  view source on GitHub ↗

Returns a list of userIds found to NOT have the questId if userIdParty is specified, will only check users in the party of the user.

(questId string, partyUserId ...int)

Source from the content-addressed store, hash-verified

402// Returns a list of userIds found to NOT have the questId
403// if userIdParty is specified, will only check users in the party of the user.
404func (r ScriptRoom) MissingQuest(questId string, partyUserId ...int) []int {
405
406 missingQuestUsers := []int{}
407
408 // Only check the user and their party?
409 if len(partyUserId) > 0 && partyUserId[0] > 0 {
410
411 if party := parties.Get(partyUserId[0]); party != nil {
412 // Check all party members
413 for _, userId := range party.GetMembers() {
414 if user := users.GetByUserId(userId); user != nil {
415 if !user.Character.HasQuest(questId) {
416 missingQuestUsers = append(missingQuestUsers, userId)
417 }
418 }
419 }
420
421 return missingQuestUsers
422 }
423
424 // No party, so just check the user
425 if user := users.GetByUserId(partyUserId[0]); user != nil {
426 if !user.Character.HasQuest(questId) {
427 missingQuestUsers = append(missingQuestUsers, user.UserId)
428 }
429 }
430 return missingQuestUsers
431
432 }
433
434 // Just check all players
435 for _, userId := range r.roomRecord.GetPlayers() {
436 if user := users.GetByUserId(userId); user != nil {
437 if !user.Character.HasQuest(questId) {
438 missingQuestUsers = append(missingQuestUsers, userId)
439 }
440 }
441 }
442
443 return missingQuestUsers
444}
445
446func (r ScriptRoom) SpawnMob(mobId int) *ScriptActor {
447

Callers 3

onIdleFunction · 0.80
onIdleFunction · 0.80
onIdleFunction · 0.80

Calls 5

GetFunction · 0.92
GetByUserIdFunction · 0.92
GetMembersMethod · 0.45
HasQuestMethod · 0.45
GetPlayersMethod · 0.45

Tested by

no test coverage detected