public void AcceptMission(ServerPlayer a_player) { if (m_missionProposals.ContainsKey(a_player.m_pid)) { if (!m_missions.ContainsKey(a_player.m_pid)) { m_missions.Add(a_player.m_pid, new List <Mission>()); } Mission mission = (Mission)m_missionProposals[a_player.m_pid]; MissionNpc nearbyNpc = GetNearbyNpc(a_player.GetPosition()); if (null != nearbyNpc && nearbyNpc.m_mission.IsEqual(mission)) { nearbyNpc.AcceptMission(); } mission.m_dieTime = Time.time + 3600f; ((List <Mission>)m_missions[a_player.m_pid]).Add(mission); m_missionProposals.Remove(a_player.m_pid); UpdatePlayer(a_player); } }
public bool RequestMission(ServerPlayer a_player) { bool flag = m_missions.ContainsKey(a_player.m_pid) && 3 <= ((List <Mission>)m_missions[a_player.m_pid]).Count; MissionNpc nearbyNpc = GetNearbyNpc(a_player.GetPosition()); if (null != nearbyNpc) { if (flag) { m_server.SendSpecialEvent(a_player, eSpecialEvent.tooManyMissions); } else { bool flag2 = false; if (m_missions.ContainsKey(a_player.m_pid)) { List <Mission> list = (List <Mission>)m_missions[a_player.m_pid]; for (int i = 0; i < list.Count; i++) { if (list[i].IsEqual(nearbyNpc.m_mission)) { flag2 = true; m_server.SendSpecialEvent(a_player, eSpecialEvent.alreadyGotMission); break; } } } if (!flag2) { m_missionProposals[a_player.m_pid] = nearbyNpc.m_mission; m_server.SendMissionPropose(a_player, nearbyNpc.m_mission); } } } return(!flag && null != nearbyNpc); }