/// <summary> /// This occurs when aoe kills the npc. /// Background task that searches for the related missionguid and sumbits the kill for that specific player /// </summary> private void SearchForMissionOwnerAndSubmitKill(IZone zone, Unit killerUnit) { var missionGuid = GetMissionGuid(); var missionOwner = MissionHelper.FindMissionOwnerByGuid(missionGuid); var missionOwnerPlayer = zone.GetPlayer(missionOwner); if (missionOwnerPlayer == null) { //the owner is not this zone //address the mission plugin directly var info = new Dictionary <string, object> { { k.characterID, missionOwner.Id }, { k.guid, missionGuid.ToString() }, { k.type, MissionTargetType.kill_definition }, { k.definition, ED.Definition }, { k.increase, 1 }, { k.zoneID, zone.Id }, { k.position, killerUnit.CurrentPosition } }; if (killerUnit is Player killerPlayer && killerPlayer.Character.Id != missionOwner.Id) { info[k.assistingCharacterID] = killerPlayer.Character.Id; } Task.Run(() => { MissionHelper.MissionProcessor.NpcGotKilledInAway(missionOwner, missionGuid, info); }); return; } //local enqueue, this is the proper player, we can skip gang EnqueueKill(missionOwnerPlayer, killerUnit); }
public void ServerAddsParticipant(Guid guid, Character doerCharacter) { var ownerCharacter = MissionHelper.FindMissionOwnerByGuid(guid); if (ownerCharacter == Character.None) { Logger.Error($" no mission owner character was found for guid:{guid.ToString()}"); return; } if (doerCharacter == Character.None) { Logger.Error($" WTF? in MissionServerAddsParticipantHandler. doerCharacterId:{doerCharacter.Id} mission owner characterId:{ownerCharacter.Id}"); return; } var gang = ownerCharacter.GetGang(); if (gang == null) { return; } if (!gang.IsMember(doerCharacter)) { return; } if (!FindMissionInProgress(ownerCharacter, guid, out MissionInProgress missionInProgress)) { Logger.Error($" no mission was found for characterId:{ownerCharacter.Id} guid:{guid.ToString()}"); return; } Logger.DebugInfo($" >>>> missionGuid:{guid.ToString()} mission owner:{ownerCharacter.Id} new participant:{doerCharacter.Id}"); missionInProgress.AddParticipant(doerCharacter); }