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)
| 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. |
| 404 | func (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 | |
| 446 | func (r ScriptRoom) SpawnMob(mobId int) *ScriptActor { |
| 447 |
no test coverage detected