void CheckQuestCollectionSkillItem(ArkQuest _quest) { QuestData questData = _quest.GetQuestData(); int questID = questData.Info.ID; if (!dicQuestCollectSkillItem.ContainsKey(questID)) { List<AchGetQuestCollection> getQuestCollection = questData.Achievement.GetDatas<AchGetQuestCollection>(); dicQuestCollectSkillItem.Add(questID, new List<int>()); foreach (AchGetQuestCollection questCollection in getQuestCollection) { if (questCollection.SkillItemID == 0) continue; if (!dicQuestCollectSkillItem[questID].Contains(questCollection.SkillItemID)) dicQuestCollectSkillItem[questID].Add(questCollection.SkillItemID); } } }
void CheckAlreadyHaveProduceMastery(ArkQuest _quest) { List<AchProductionMastery> listProduceMastery = _quest.GetQuestData().Achievement.GetDatas<AchProductionMastery>(); if (listProduceMastery.Count > 0) { foreach (AchProductionMastery mastery in listProduceMastery) { if (mastery.ProductionType == eITEM_PRODUCT_TECHNIQUE_TYPE.eITEM_PRODUCT_TECHNIQUE_MAX) { int lv = AsUserInfo.Instance.HaveProductTechLvMax(); if (lv != 0) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_PRODUCE_MASTERY, new AchProductionMastery(mastery.ProductionType, lv)); } else { int lv = AsUserInfo.Instance.GetProductTechniqueLv(mastery.ProductionType); if (lv != 0) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_PRODUCE_MASTERY, new AchProductionMastery(mastery.ProductionType, lv)); } } } }
void CheckKillMonKindSkillItem(ArkQuest _quest) { QuestData questData = _quest.GetQuestData(); int questID = questData.Info.ID; if (!dicKillMonKindSkillItem.ContainsKey(questID)) { List<AchKillMonsterKind> killMonList = questData.Achievement.GetDatas<AchKillMonsterKind>(); dicKillMonKindSkillItem.Add(questID, new List<int>()); dicKillMonsterKindAch.Add(questID, new List<AchKillMonsterKind>()); foreach (AchKillMonsterKind killMonKind in killMonList) { if (killMonKind.SkillItemID == 0) continue; if (!dicKillMonKindSkillItem[questID].Contains(killMonKind.SkillItemID)) dicKillMonKindSkillItem[questID].Add(killMonKind.SkillItemID); dicKillMonsterKindAch[questID].Add(killMonKind); } } }
void CheckGetItemFromMonKindSkillItem(ArkQuest _quest) { QuestData questData = _quest.GetQuestData(); int questID = questData.Info.ID; if (!dicGetItemFromMonKindSkillItem.ContainsKey(questID)) { List<AchGetItemFromMonsterKind> getItemFromMonList = questData.Achievement.GetDatas<AchGetItemFromMonsterKind>(); dicGetItemFromMonKindSkillItem.Add(questID, new List<int>()); dicGetItemFromMonKind.Add(questID, new List<AchGetItemFromMonsterKind>()); foreach (AchGetItemFromMonsterKind getItemFromMon in getItemFromMonList) { if (getItemFromMon.SkillItemID == 0) continue; if (!dicGetItemFromMonKindSkillItem[questID].Contains(getItemFromMon.SkillItemID)) dicGetItemFromMonKindSkillItem[questID].Add(getItemFromMon.SkillItemID); dicGetItemFromMonKind[questID].Add(getItemFromMon); } } }
void CheckFriendship(ArkQuest _quest) { QuestData questData = _quest.GetQuestData(); List<AchFriendship> listFriendship = questData.Achievement.GetDatas<AchFriendship>(); foreach (AchFriendship friendship in listFriendship) AsCommonSender.SendQuestInfo(questData.Info.ID, friendship.AchievementNum); }
void CheckUseItemToTarget(ArkQuest _quest) { QuestData questData = _quest.GetQuestData(); int questID = questData.Info.ID; if (!dicUseItemToTarget.ContainsKey(questID)) { List<AchUseItemToTarget> useItemToTargetList = questData.Achievement.GetDatas<AchUseItemToTarget>(); dicUseItemToTarget.Add(questID, new List<int>()); dicUseItemToTargetAch.Add(questID, new List<AchUseItemToTarget>()); foreach (AchUseItemToTarget useItem in useItemToTargetList) { if (!dicUseItemToTarget[questID].Contains(useItem.ItemID)) dicUseItemToTarget[questID].Add(useItem.ItemID); dicUseItemToTargetAch[questID].Add(useItem); } } }
void CheckAlreayHaveItem(ArkQuest _quest) { List<int> listID = _quest.GetQuestItemIDList(); foreach (int itemID in listID) { int itemCount = ItemMgr.HadItemManagement.Inven.GetItemTotalCount(itemID); if (itemCount > 0) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_GET_ITEM_COUNT_CHANGE, new AchGetItem(itemID, itemCount)); } }
/// <summary> /// ����Ʈ�� �����Ѵ� /// </summary> /// <param name="_questID"></param> public void AcceptQuest(int _questID, bool bIsRunning) { #region -GameGuide_QuestAccept AsGameGuideManager.Instance.CheckUp(eGameGuideType.QuestAgree, _questID); #endregion ArkQuest quest = ArkQuest.CreateArkQuest(_questID, gameObject).GetComponent<ArkQuest>(); QuestData questData = quest.GetQuestData(); // wanted quest exception if (questData.Info.QuestType == QuestType.QUEST_WANTED) { if (acceptedWantedQuest != null) { GameObject.DestroyImmediate(dicQuestObjects[_questID].gameObject); if (dicQuestObjects.ContainsKey(_questID)) { dicQuestObjects.Remove(_questID); dicQuests.Remove(_questID); } } acceptedWantedQuest = quest; if (questData.NowQuestProgressState == QuestProgressState.QUEST_PROGRESS_CLEAR) questData.Achievement.SetAllComplete(); } if (bIsRunning == false) quest.NowQuestProgressState = QuestProgressState.QUEST_PROGRESS_IN; // add Monster Target Info if (quest.NowQuestProgressState == QuestProgressState.QUEST_PROGRESS_IN) AddMonInfoForTargetMark(questData); // check time achievement CheckTimeAchievement(quest, false); quest.StartTimeLimit(); // check quest Item CheckHaveQuestItem(quest); // check get quest collection CheckHaveGetQuestCollection(quest); // add Quest if (!dicQuestObjects.ContainsKey(_questID)) { Debug.Log("Add Quest " + _questID); dicQuestObjects.Add(_questID, quest.gameObject); dicQuests.Add(_questID, quest); } // add npc daily group if (questData.Info.QuestType == QuestType.QUEST_NPC_DAILY) if (!listUseNpcDailyGroup.Contains(questData.Info.NpcDailyGroupID)) listUseNpcDailyGroup.Add(questData.Info.NpcDailyGroupID); if (bIsRunning == false && quest.NowQuestProgressState == QuestProgressState.QUEST_PROGRESS_IN) { if (questData.Achievement.CheckHaveAchType(typeof(AchMapInto))) AsIntoMapTriggerManager.instance.UpdateIntoMapTrigger(TerrainMgr.Instance.GetCurMapID()); if (questData.Achievement.CheckHaveAchType(typeof(AchUseItemInMap))) AsUseItemInMapMarkManager.instance.UpdateUseItemInMapMark(TerrainMgr.Instance.GetCurMapID()); if (questData.Achievement.CheckHaveAchType(typeof(AchGetRankPoint))) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_GET_RANK_POINT, new AchGetRankPoint(AsUserInfo.Instance.RankPoint)); UIMessageBroadcaster.instance.SendUIMessage(UIMessageType.UI_MESSAGE_QUESTLIST_UPDATE); if (AsHudDlgMgr.Instance.IsOpenQuestBook) { if (questData.Info.QuestType == QuestType.QUEST_DAILY) AsHudDlgMgr.Instance.questBook.UpdateDailyList(); else AsHudDlgMgr.Instance.questBook.UpdateAcceptedList(); } resultUI.ShowResultMessage(QuestResult.QUEST_ACCEPT); guideArrow.ShowGuideArrow(questData.Info.QuestGuideDirect); QuestTutorialMgr.Instance.ProcessQuestTutorialMsg(new QuestTutorialMsgInfo(QuestTutorialMsg.ACCEPT_QUEST, questData.Info.ID)); } CheckAlreayHaveItem(quest); CheckUseItemToTarget(quest); CheckAlreadyEquipItem(quest); CheckKillMonKindSkillItem(quest); CheckGetItemFromMonKindSkillItem(quest); CheckQuestCollectionSkillItem(quest); // quest item AsUseItemToMonTriggerManager.instance.AddUseItemToMonTrigger(questData); // check add party if (bIsRunning == false) { List<AchAddParty> listParty = questData.Achievement.GetDatas<AchAddParty>(); if (listParty.Count > 0) { if (AsPartyManager.Instance != null) if (AsPartyManager.Instance.IsPartying == true) { Dictionary<uint, AS_PARTY_USER> dicMember = AsPartyManager.Instance.GetPartyMemberList(); if (dicMember != null) { int partyMemCount = dicMember.Count; QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_ADD_PARTY, new AchAddParty(partyMemCount)); } } } } // check minimap if (bIsRunning == false) { if (CheckHaveOpenUIType(OpenUIType.MINIMAP) != null && AsHudDlgMgr.Instance != null) if (AsHudDlgMgr.Instance.IsOpenWorldMapDlg == true) AsCommonSender.SendClearOpneUI(OpenUIType.MINIMAP); } if (bIsRunning == false) AsUseItemToTargetPanelManager.instance.UpdateUseItemToTargetPanel(); // Check Gold Quest if (questData.Achievement.GetDatas<AchGold>().Count > 0) { dicQuestContainGoldAchieve.Add(questData.Info.ID, quest); QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_GET_GOLD, new AchGold(GoldAchType.GOLD_GET, AsUserInfo.Instance.SavedCharStat.nGold)); QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_GET_BACK_GOLD, new AchGold(GoldAchType.GOLD_GET_BACK, AsUserInfo.Instance.SavedCharStat.nGold)); } CheckAlreadyHaveSkill(quest); CheckAlreadyHaveProduceMastery(quest); if (bIsRunning == false) { CheckFriendship(quest); // check Designation List<AchDesignation> listDesignation = questData.Achievement.GetDatas<AchDesignation>(); { foreach (AchDesignation ach in listDesignation) { if (ach.type == DesignationAchType.DESIGNATION_GET) { if (AsDesignationManager.Instance.IsObtainedDesignation(ach.data)) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_DESIGNATION, new AchDesignation(DesignationAchType.DESIGNATION_GET, ach.data)); } else if (ach.type == DesignationAchType.DESIGNATION_CHANGE) { if (ach.data == 0) continue; DesignationData data = AsDesignationManager.Instance.GetCurrentDesignation(); if (data == null) continue; if (ach.data == data.id) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_DESIGNATION, new AchDesignation(DesignationAchType.DESIGNATION_ALREADY_EQUIP, data.id)); } } } if (AsHudDlgMgr.Instance.IsOpenWorldMapDlg == true) AsHudDlgMgr.Instance.worldMapDlg.UpdateZoneMapImg(); List<AchMetaQuest> listMetaQuest = questData.Achievement.GetDatas<AchMetaQuest>(); foreach (AchMetaQuest meta in listMetaQuest) { if (listCompleteQuestIdx.Contains(meta.questID)) { QuestData questComplete = AsTableManager.Instance.GetTbl_QuestData(meta.questID); if (questComplete != null) if (questComplete.CanRepeat() == false) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_META_QUEST, new AchMetaQuest(meta.questID)); } } } if (bIsRunning == true) { List<AchMetaQuest> metas = questData.Achievement.GetDatas<AchMetaQuest>(); foreach (AchMetaQuest meta in metas) { if (!listMetaQuest.Contains(meta.questID)) listMetaQuest.Add(meta.questID); } } CheckQuestMarkAllNpcAndCollecion(); if (bIsRunning == false && quest.NowQuestProgressState == QuestProgressState.QUEST_PROGRESS_IN) { CheckGetLevel(quest); CheckAlreadyHaveSocialPoint(quest); AskWarp(quest.GetQuestData()); } if (bIsRunning == false && AsHudDlgMgr.Instance.IsOpenWorldMapDlg == true) AsHudDlgMgr.Instance.worldMapDlg.GetZoneLogic().UpdateNpcQuestIcon(); // quest miniView if (bIsRunning == false) UpdateQuestMiniView(); // questList if (AsHUDController.Instance != null && bIsRunning == false) { if (AsHudDlgMgr.Instance != null) AsHudDlgMgr.Instance.UpdateQuestRelationUI(_questID); if (AsHUDController.Instance.m_NpcMenu != null) { QuestHolder questHolder = AsHUDController.Instance.m_NpcMenu.questHolder; if (questHolder != null) { QuestMarkType questMarkType = questHolder.GetQuestMarkType(); if (questMarkType == QuestMarkType.NOTHING || questMarkType == QuestMarkType.PROGRESS || questMarkType == QuestMarkType.CLEAR || questMarkType == QuestMarkType.TALK_CLEAR || questMarkType == QuestMarkType.CLEAR_NPC_DAILY || questMarkType == QuestMarkType.CLEAR_REMAINTALK || questMarkType == QuestMarkType.TALK_HAVE || questMarkType == QuestMarkType.HAVE_EVENT || questMarkType == QuestMarkType.HAVE_EVENT_AND_PROGRESS) { UIMessageBroadcaster.instance.SendUIMessage(UIMessageType.UI_MESSAGE_TALK_CLOSE); AsHudDlgMgr.Instance.CloseQuestAccept(); AskQuestPartyMatching(questData); return; } else if (questMarkType == QuestMarkType.HAVE || questMarkType == QuestMarkType.CLEAR_AND_HAVE || questMarkType == QuestMarkType.HAVE_NPC_DAILY || questMarkType == QuestMarkType.UPPERLEVEL || questMarkType == QuestMarkType.LOWERLEVEL) { UIMessageBroadcaster.instance.SendUIMessage(UIMessageType.UI_MESSAGE_QUESTLIST_SHOW); AskQuestPartyMatching(questData); } AsHudDlgMgr.Instance.CloseQuestAccept(); } else // if DailyQuest AsHudDlgMgr.Instance.CloseQuestAccept(); } } }
void CheckGetLevel(ArkQuest _quest) { List<AchGetLevel> listGetLevel = _quest.GetQuestData().Achievement.GetDatas<AchGetLevel>(); foreach (AchGetLevel getLevel in listGetLevel) { int nowLevel = AsEntityManager.Instance.UserEntity.GetProperty<int>(eComponentProperty.LEVEL); if (nowLevel >= getLevel.Level) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_LEVEL_UP, new AchGetLevel(nowLevel)); } }
void CheckTimeAchievement(ArkQuest _quest, bool _isDrop) { if (_quest == null) { Debug.LogError("(checkTimeAchievement) ArkQeust is null"); return; } if (_quest.NowQuestProgressState != QuestProgressState.QUEST_PROGRESS_IN) return; // check time achievement List<AchTimeLimit> listTimeLimit = _quest.GetQuestData().Achievement.GetDatas<AchTimeLimit>(); List<AchTimeSurvival> listTimeSruvival = _quest.GetQuestData().Achievement.GetDatas<AchTimeSurvival>(); if (_isDrop == true && (listTimeLimit.Count > 0 || listTimeSruvival.Count > 0)) { if (questTime != null) GameObject.DestroyImmediate(questTime.gameObject); return; } if (listTimeLimit.Count > 0 || listTimeSruvival.Count > 0) { if (_quest.NowQuestProgressState != QuestProgressState.QUEST_PROGRESS_FAIL) { if (questTime == null) { GameObject questTimeObj = GameObject.Instantiate(Resources.Load("UI/Optimization/Prefab/QuestTimeDlg")) as GameObject; questTime = questTimeObj.GetComponent<QuestTimeDlg>(); } else questTime.gameObject.SetActiveRecursively(true); if (questTime != null) _quest.TimeSpriteText = questTime.questTimeText; if (AsGameMain.s_gameState != GAME_STATE.STATE_INGAME) questTime.questTimeText.gameObject.layer = LayerMask.NameToLayer("Default"); visibleTimeUI = true; } else { if (questTime != null) { GameObject.DestroyImmediate(questTime.gameObject); questTime = null; } visibleTimeUI = false; } } }
void CheckHaveGetQuestCollection(ArkQuest _quest) { QuestData questData = _quest.GetQuestData(); List<AchGetQuestCollection> listQuestCollection = questData.Achievement.GetDatas<AchGetQuestCollection>(); if (listQuestCollection.Count > 0) { List<AchGetQuestCollection> listAch = new List<AchGetQuestCollection>(); foreach (AchGetQuestCollection getQuestCollection in listQuestCollection) listAch.Add(getQuestCollection); if (dicGetQuestCollection.ContainsKey(questData.Info.ID)) dicGetQuestCollection[questData.Info.ID] = listAch; else dicGetQuestCollection.Add(questData.Info.ID, listAch); } }
void CheckHaveQuestItem(ArkQuest _quest) { int itemCount = 0; int questID = _quest.GetQuestData().Info.ID; QuestAchievement ach = _quest.GetQuestData().Achievement; itemCount += ach.GetDataCount<AchGetItem>(); itemCount += ach.GetDataCount<AchGetItemFromMonster>(); itemCount += ach.GetDataCount<AchGetItemFromMonsterKind>(); itemCount += ach.GetDataCount<AchGetQuestCollection>(); if (itemCount > 0) { if (!dicQuestContainQuestItem.ContainsKey(questID)) dicQuestContainQuestItem.Add(questID, _quest); } }
public void CompleteQuest(int _questID) { #region -GameGuide_QuestComplete AsGameGuideManager.Instance.CheckUp(eGameGuideType.QuestComplete, _questID); #endregion if (dicQuestObjects.ContainsKey(_questID)) { ArkQuest quest = dicQuestObjects[_questID].GetComponent<ArkQuest>(); QuestData questData = quest.GetQuestData(); DeleteQuest(questData.Info.ID); resultUI.ShowResultMessage(QuestResult.QUEST_COMPLETE); if (questData.Info.QuestType == QuestType.QUEST_DAILY) { quest.NowQuestProgressState = QuestProgressState.QUEST_PROGRESS_COMPLETE; } else { questData.IncreaseQuestCompleteCount(); if (questData.CanRepeat() == false) { quest.NowQuestProgressState = QuestProgressState.QUEST_PROGRESS_COMPLETE; QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_META_QUEST, new AchMetaQuest(questData.Info.ID)); } else { quest.GetQuestData().Achievement.Reset(); quest.NowQuestProgressState = QuestProgressState.QUEST_PROGRESS_NOTHING; } } if (questData.Info.QuestType == QuestType.QUEST_DAILY) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_COMPLETE_DAILY_QUEST, new AchCompleteDailyQuest(questData.Info.QuestMapID, 1)); QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_COMPLETE_QUEST, new AchCompleteQuest(questData.Info.QuestType, questData.Info.QuestMapID, 1)); // �Ϸ� ����Ʈ ���� SetCompleteQuest(_questID, questData); CheckQuestMarkAllNpcAndCollecion(); AfterProcessingForNpcTalkUI(); AsHudDlgMgr.Instance.UpdateQuestBookBtn(); //UpdateSortQuestList(); UpdateQuestMiniView(); if (dicGetQuestCollection.ContainsKey(_questID)) dicGetQuestCollection.Remove(_questID); if (questData.Info.QuestType == QuestType.QUEST_WANTED) { acceptedWantedQuest = null; if (AsHudDlgMgr.Instance.wantedQuestBtn != null) AsHudDlgMgr.Instance.wantedQuestBtn.gameObject.SetActiveRecursively(false); } if (AsHudDlgMgr.Instance.IsOpenQuestBook) AsHudDlgMgr.Instance.questBook.UpdateAcceptedList(); if (AsHudDlgMgr.Instance.IsOpenQuestBook) AsHudDlgMgr.Instance.questBook.UpdateDailyList(); AsHudDlgMgr.Instance.CloseQuestAccept(); if (AsHudDlgMgr.Instance.IsOpenWorldMapDlg == true) AsHudDlgMgr.Instance.worldMapDlg.GetZoneLogic().UpdateNpcQuestIcon(); // show quest reward Msg ShowRewardItemMsgBox(_questID); } }
void CheckAlreadyHaveSkill(ArkQuest _quest) { List<AchGetSkill> listGetSkill = _quest.GetQuestData().Achievement.GetDatas<AchGetSkill>(); if (listGetSkill.Count > 0) { foreach (AchGetSkill getskill in listGetSkill) { Tbl_SkillBook_Record skillBookRecord = AsTableManager.Instance.GetTbl_SkillBook_Record(getskill.SkillID); if (skillBookRecord == null) return; bool haveSkillFirst = SkillBook.Instance.ContainSkillTableID(skillBookRecord.Skill1_Index); bool haveSkillSecond = SkillBook.Instance.ContainSkillTableID(skillBookRecord.Skill2_Index); if (haveSkillFirst || haveSkillSecond) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_GET_SKILL, getskill); } } }
void CheckAlreadyEquipItem(ArkQuest _quest) { QuestData data = _quest.GetQuestData(); List<AchEquipItem> listAchEquipItem = data.Achievement.GetDatas<AchEquipItem>(); foreach (AchEquipItem equip in listAchEquipItem) { if (equip.IsComplete == true) continue; if (ItemMgr.HadItemManagement.Inven.IsHaveEquipItem(equip.ItemID) || ItemMgr.HadItemManagement.Inven.IsHaveCosEquipItem(equip.ItemID)) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_EQUIP_ITEM, new AchEquipItem(equip.ItemID)); } }
void CheckAlreadyHaveSocialPoint(ArkQuest _quest) { List<AchSocialPoint> listSocialPoint = _quest.GetQuestData().Achievement.GetDatas<AchSocialPoint>(); if (listSocialPoint.Count > 0) QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_SOCIAL_POINT, new AchSocialPoint(AsSocialManager.Instance.SocialData.SocialPoint)); }
UIListItem AddQuest(ArkQuest quest) { ArkSphereQuestTool.QuestData data = quest.GetQuestData(); UIListItem item = questList.CreateItem(questItem, questList.Count, true) as UIListItem;// quest.GetQuestData().Info.Name); item.SetInputDelegate(ListItemInputEvent); item.spriteText.Text = data.Info.Name; QuestBookItemController questBookItemController = item.GetComponent<QuestBookItemController>(); questBookItemController.questType = data.Info.QuestType; questBookItemController.questProgressState = data.NowQuestProgressState; questBookItemController.UpdateQuestStateIcon(); QuestListIconController questIconCon = item.gameObject.GetComponent<QuestListIconController>(); if (questIconCon != null) questIconCon.SetQuestIconType(data.Info.QuestType); item.SetOffset(new Vector3(0.0f, 0.0f, -0.2f)); item.gameObject.SetActive(false); return item; }