Пример #1
0
    //접속시에 이전 퀘스트가 끊긴게 없는지 확인
    public void CheckMissingQuest()
    {
        //일단 최후 퀘스트를 찾는다 - 이론상 항상 최후의 퀘스트만 할수있다
        if (QuestList.Count != 0)
        {
            uint      MaxKey    = QuestList.Keys.Max();
            QuestInfo questInfo = null;

            if (QuestList.TryGetValue(MaxKey, out questInfo))
            {
                // 해당퀘스트가 완료상태인가 아니면 패스
                if (questInfo.unComplete == 1)
                {
                    //완료상태면 보상을 받은지 체크
                    if (questInfo.unFetchBonus != 1)
                    {
                        //완료상태고 보상을 받지 않은 상태라면 보상요청
                        Quest.QuestInfo lowInfo = _LowDataMgr.instance.GetLowDataQuestData(questInfo.unTaskId);
                        if (lowInfo.LimitLevel <= NetData.instance.UserLevel)
                        {
                            NetworkClient.instance.SendPMsgTaskFetchBonusC(questInfo.unTaskId);
                        }
                    }
                    else
                    {
                        //완료상태고 보상을 받은상태라면 끊어진 퀘스트를 이어서 요청
                        SearchNextQuest(questInfo.unTaskId);
                    }
                }
            }
        }
    }
Пример #2
0
    /// <summary> 내가 보유한 마지막 퀘스트의 다음 퀘스트 넘김. </summary>
    public Quest.QuestInfo GetCurNextQuestInfo()
    {
        //내가 보유한 퀘스트중 마지막것을 찾는다.
        QuestInfo lastQuest  = null;
        var       enumerator = QuestList.GetEnumerator();

        while (enumerator.MoveNext())
        {
            lastQuest = enumerator.Current.Value;
            //다 클리어 했어햐함 && 보상까지
            if (lastQuest.unComplete == 0 || (lastQuest.unComplete == 1 && lastQuest.unFetchBonus == 0))
            {
                return(null);
            }
        }

        if (lastQuest != null)
        {
            //진행중인 퀘스트가 없다.
            Quest.QuestInfo questInfo = _LowDataMgr.instance.GetLowDataQuestData(lastQuest.unTaskId);
            if (questInfo != null)
            {
                return(_LowDataMgr.instance.GetLowDataQuestData(questInfo.NextQuestId));
            }
        }

        return(null);
    }
Пример #3
0
 // 퀘스트 정보를 받아옴
 public void GetQuestInfo(QuestInfo info)
 {
     Debug.Log("Get Quest");
     questInfo = info;
     isQuest = true;
     QuestTypes();
 }
Пример #4
0
        private void RewardQuest(QuestInfo info, ushort reward)
        {
            if (reward != 0)
            {
                if (!info.Rewards.TryGetValue(reward, out Quest2RewardEntry entry))
                {
                    throw new QuestException($"Player {player.CharacterId} tried to complete quest {info.Entry.Id} with invalid reward!");
                }

                // TODO: make sure reward is valid for player, some rewards are conditional

                RewardQuest(entry);
            }

            // TODO: fixed rewards

            uint experience = info.GetRewardExperience();

            if (experience != 0u)
            {
                // TODO: reward experience
            }

            uint money = info.GetRewardMoney();

            if (money != 0u)
            {
                player.CurrencyManager.CurrencyAddAmount(CurrencyType.Credits, money);
            }
        }
Пример #5
0
        /// <summary>
        /// Share supplied <see cref="Quest.Quest"/> with another <see cref="Player"/>.
        /// </summary>
        public void QuestShare(ushort questId)
        {
            QuestInfo info = GlobalQuestManager.GetQuestInfo(questId);

            if (info == null)
            {
                throw new ArgumentException($"Invalid quest {questId}!");
            }

            Quest.Quest quest = GetQuest(questId);
            if (quest == null)
            {
                throw new QuestException($"Player {player.CharacterId} tried to share quest {questId} which they don't have!");
            }

            if (!quest.CanShare())
            {
                throw new QuestException($"Player {player.CharacterId} tried to share quest {questId} which can't be shared!");
            }

            Player recipient = player.GetVisible <Player>(player.TargetGuid);

            if (recipient == null)
            {
                throw new QuestException($"Player {player.CharacterId} tried to share quest {questId} to an invalid player!");
            }

            // TODO

            log.Trace($"Shared quest {questId} with player {recipient.Name}.");
        }
Пример #6
0
        /// <summary>
        /// Create a new <see cref="QuestManager"/> from existing <see cref="Character"/> database model.
        /// </summary>
        public QuestManager(Player owner, Character model)
        {
            player = owner;

            foreach (CharacterQuest questModel in model.CharacterQuest)
            {
                QuestInfo info = GlobalQuestManager.GetQuestInfo(questModel.QuestId);
                if (info == null)
                {
                    log.Error($"Player {player.CharacterId} has an invalid quest {questModel.QuestId}!");
                    continue;
                }

                var quest = new Quest.Quest(player, info, questModel);
                switch (quest.State)
                {
                case QuestState.Completed:
                    completedQuests.Add(quest.Id, quest);
                    break;

                case QuestState.Botched:
                case QuestState.Ignored:
                    inactiveQuests.Add(quest.Id, quest);
                    break;

                case QuestState.Accepted:
                case QuestState.Achieved:
                    activeQuests.Add(quest.Id, quest);
                    break;
                }
            }
        }
Пример #7
0
    // 현재 진행중인 퀘스트만 찾는다.
    // 다음 퀘스트는 searchNextQuest로 서버에 요청하여 받아야 한다. 2017.10.18.kyh
    public QuestInfo GetCurrentQuestInfo()
    {
        //현재 진행중인 퀘스틀 찾아서 리턴해주는데 어떻게 알지? - 일단 Complet가 0인걸 찾음, 못찾았을경우 Complet는 1인데 Fetch가 0인걸 찾음
        QuestInfo lastQuest  = null;
        var       enumerator = QuestList.GetEnumerator();

        while (enumerator.MoveNext())
        {
            lastQuest = enumerator.Current.Value;//마지막께 들어있을 것이다.
            if (lastQuest.unComplete == 0)
            {
                //진행중인 퀘스트
                return(lastQuest);
            }
        }

        //여기까지 왔다 그럼 Complet가 0인걸 찾지못함 이제 Complet는 1이고 Fetch가 0인걸 찾자
        enumerator = QuestList.GetEnumerator();
        while (enumerator.MoveNext())
        {
            if (enumerator.Current.Value.unComplete == 1 && enumerator.Current.Value.unFetchBonus == 0)
            {
                //퀘스트는 완료되었고 보상은 안받은 퀘스트
                return(enumerator.Current.Value);
            }
        }

        //진행중인 퀘스트가 없다.
        return(null);
    }
Пример #8
0
    public bool OnReceiveQuestInfoAck(ERandomwarsQuestErrorCode errorCode, QuestInfo questInfo)
    {
        UI_Main.Get().obj_IndicatorPopup.SetActive(false);

        // var anchPos = rts_Content.anchoredPosition;
        // anchPos.y = 0;
        // rts_Content.anchoredPosition = anchPos;

        if (errorCode == ERandomwarsQuestErrorCode.Success)
        {
            dateTime = DateTime.Now.AddSeconds(questInfo.RemainResetTime);

            dailyRewardID       = questInfo.DayRewardInfo.DayRewardId;
            arrIsDailyRewardGet = questInfo.DayRewardInfo.DayRewardState;

            var dataDailyReward = new TDataQuestDayReward();
            if (TableManager.Get().QuestDayReward.GetData(questInfo.DayRewardInfo.DayRewardId, out dataDailyReward))
            {
                TDataItemList itemData;
                if (TableManager.Get().ItemList.GetData(item => item.id == dataDailyReward.rewardItem01, out itemData))
                {
                    arrImage_Reward[0].sprite = FileHelper.GetIcon(itemData.itemIcon);
                }
                if (TableManager.Get().ItemList.GetData(item => item.id == dataDailyReward.rewardItem02, out itemData))
                {
                    arrImage_Reward[1].sprite = FileHelper.GetIcon(itemData.itemIcon);
                }
                // if (TableManager.Get().ItemList.GetData(item => item.id == dataDailyReward.rewardItem03, out itemData))
                // {
                //     arrImage_Reward[2].sprite = FileHelper.GetIcon(itemData.itemIcon);
                // }

                arrText_Reward[0].text = $"x{dataDailyReward.rewardItemValue01}";
                arrText_Reward[1].text = $"x{dataDailyReward.rewardItemValue02}";
                arrText_Reward[2].text = $"x{dataDailyReward.rewardItemValue03}";

                arrBtn_Reward[0].interactable = !arrIsDailyRewardGet[0];
                arrBtn_Reward[1].interactable = !arrIsDailyRewardGet[1];
                arrBtn_Reward[2].interactable = !arrIsDailyRewardGet[2];
            }

            list.Clear();
            for (int i = 0; i < questInfo.QuestData.Length || i < listSlot.Count; i++)
            {
                if (i >= questInfo.QuestData.Length)
                {
                    listSlot[i].gameObject.SetActive(false);
                    continue;
                }
                listSlot[i].gameObject.SetActive(true);
                list.Add(questInfo.QuestData[i]);
                listSlot[i].Initialize(questInfo.QuestData[i]);
            }
        }

        Open();

        return(true);
    }
Пример #9
0
        private void QuestAdd(QuestInfo info, Quest.Quest quest, Item item)
        {
            if (quest?.State == QuestState.Accepted || quest?.State == QuestState.Achieved)
            {
                throw new QuestException($"Player {player.CharacterId} tried to start quest {info.Entry.Id} which is already in progress!");
            }

            // if quest has already been completed make sure it's repeatable and the reset period has elapsed
            if (quest?.State == QuestState.Completed)
            {
                if (info.Entry.QuestRepeatPeriodEnum == 0u)
                {
                    throw new QuestException($"Player {player.CharacterId} tried to start quest {info.Entry.Id} which they have already completed!");
                }

                DateTime?resetTime = GetQuest((ushort)info.Entry.Id, GetQuestFlags.Completed).Reset;
                if (DateTime.UtcNow < resetTime)
                {
                    throw new QuestException($"Player {player.CharacterId} tried to start quest {info.Entry.Id} which hasn't reset yet!");
                }
            }

            if (item != null)
            {
                if (info.Entry.Id != item.Entry.Quest2IdActivation)
                {
                    throw new QuestException($"Player {player.CharacterId} tried to start quest {info.Entry.Id} from invalid item {item.Entry.Id}!");
                }

                // TODO: consume charge
            }
            else
            {
                // make sure the player is in range of a quest giver or they are eligible for a communicator message that starts the quest
                if (!GlobalQuestManager.Instance.GetQuestGivers((ushort)info.Entry.Id)
                    .Any(c => player.GetVisibleCreature <WorldEntity>(c).Any()))
                {
                    if (!info.IsCommunicatorReceived())
                    {
                        throw new QuestException($"Player {player.CharacterId} tried to start quest {info.Entry.Id} without quest giver!");
                    }

                    if (!GlobalQuestManager.Instance.GetQuestCommunicatorMessages((ushort)info.Entry.Id)
                        .Any(m => m.Meets(player)))
                    {
                        throw new QuestException($"Player {player.CharacterId} tried to start quest {info.Entry.Id} without communicator message!");
                    }
                }
            }

            // server doesn't send an error message for prerequisites since the client does the exact same checks
            // it's assumed that a player could never get here without cheating in some way
            if (!MeetsPrerequisites(info))
            {
                throw new QuestException($"Player {player.CharacterId} tried to start quest {info.Entry.Id} without meeting the prerequisites!");
            }

            QuestAdd(info);
        }
Пример #10
0
    public void sendQuestToServer(Quest quest, short type)
    {
        QuestInfo questInfo = new QuestInfo();

        questInfo.questClassInBytes = Tools.objectToByteArray(quest);
        con.Send(type, questInfo);
        Debug.Log("QUEST SENT");
    }
 public virtual void Awake()
 {
     isOpen          = false;
     quests          = new QuestInfo[0];
     groups          = new string[0];
     selectedQuest   = string.Empty;
     noQuestsMessage = string.Empty;
 }
Пример #12
0
 private static void SetQuestInfo(UpdateValuesDto dto, QuestInfo questInfo, int questIndex)
 {
     var index = UpdateFields.PLAYER_QUEST_LOG_1_1 + questIndex;
     dto.Set(index, questInfo.Id);
     dto.Set(index + 1, questInfo.FinishTime);
     dto.Set(index + 2, questInfo.Short1, questInfo.Short2);
     dto.Set(index + 3, questInfo.Short3, questInfo.Short4);
 }
Пример #13
0
        public void AddPlayerToQuest(Quest q, BasePlayer player, bool showNotification = true)
        {
            QuestInfo qI = QuestINFO(player);

            qI.AddQuest(q);
            Notification(player, "You have been added to the quest!");
            SaveQuests();
        }
Пример #14
0
 public void Initialize(QuestInfo questInfo)
 {
     _questInfo            = questInfo;
     asteroidReward.text   = "+" + questInfo.asteroidReward;
     mineralReward.text    = "+" + questInfo.mineralReward;
     questName.text        = questInfo.name;
     questDescription.text = questInfo.description;
 }
Пример #15
0
    //create visual representation of quest and store information
    public void DisplayQuest(QuestInfo info)
    {
        var temp = Instantiate(questPrefab);

        temp.GetComponentInChildren <Text>().text = info.description;
        questList.Add(info, temp);
        temp.transform.parent = questGeneratorCanvas.transform;
    }
Пример #16
0
 public static List <QuestAwardInfo> GetQuestGoods(QuestInfo info)
 {
     if (QuestMgr.m_questgoods.ContainsKey(info.ID))
     {
         return(QuestMgr.m_questgoods[info.ID]);
     }
     return(null);
 }
Пример #17
0
 public static List <QuestConditionInfo> GetQuestCondiction(QuestInfo info)
 {
     if (QuestMgr.m_questcondiction.ContainsKey(info.ID))
     {
         return(QuestMgr.m_questcondiction[info.ID]);
     }
     return(null);
 }
Пример #18
0
 public QuestCounter(QuestInfo questInfo, ItemInventory itemInventory, ShipInventory shipInventory, BattleInfo battleInfo)
 {
     _questInfo     = questInfo;
     _quests        = questInfo.QuestDictionary;
     _itemInventory = itemInventory;
     _shipInventory = shipInventory;
     _battleInfo    = battleInfo;
 }
Пример #19
0
 private void UnlockNextQuest(QuestInfo currentQuest)
 {
     if (currentQuest.nextQuestToUnlock != 0)
     {
         var unlockQuest = questList.quests.Find(quest => quest.questNumber == currentQuest.nextQuestToUnlock);
         GameLogic.Instance.LabsControl.AddQuestToList(unlockQuest);
     }
 }
Пример #20
0
        public void RemovePlayerFromQuest(Quest q, BasePlayer player, bool QuestCompleted = false)
        {
            QuestInfo qI = QuestINFO(player);

            qI.RemoveQuest(q);
            Notification(player, "You have been removed from the quest!");
            SaveQuests();
        }
Пример #21
0
        private static void SetQuestInfo(UpdateValuesDto dto, QuestInfo questInfo, int questIndex)
        {
            var index = UpdateFields.PLAYER_QUEST_LOG_1_1 + questIndex;

            dto.Set(index, questInfo.Id);
            dto.Set(index + 1, questInfo.FinishTime);
            dto.Set(index + 2, questInfo.Short1, questInfo.Short2);
            dto.Set(index + 3, questInfo.Short3, questInfo.Short4);
        }
Пример #22
0
 public static bool IsTrunk(QuestInfo qInfo)
 {
     if (qInfo == null)
     {
         return false;
     }
     SceneInfo info = Globals.Instance.AttDB.SceneDict.GetInfo(qInfo.ID);
     return info != null && 0 == info.Difficulty;
 }
Пример #23
0
 /// <summary>
 /// 查找一条任务的全部条件
 /// </summary>
 /// <param name="info">传入一条任务</param>
 /// <returns></returns>
 public static List <QuestConditionInfo> GetQuestCondiction(QuestInfo info)
 {
     if (m_questcondiction.ContainsKey(info.ID))
     {
         List <QuestConditionInfo> items = m_questcondiction[info.ID];
         return(items);
     }
     return(null);
 }
Пример #24
0
 public QuestInfoCache(QuestInfo info)
     : base(info)
 {
     Step         = info.QuestStep;
     KillCount    = info.KillCount;
     QuestMeter   = info.QuestMeter;
     BonusCount   = info.BonusCount;
     CreationTick = info.CreationTick;
 }
Пример #25
0
 /// <summary>
 /// プレイヤーのクエスト情報
 /// </summary>
 /// <param name="ID">データベース”QuestUser”中の既に進行中・完成したクエストID</param>
 /// <param name="stepNow">今進行中のステップ</param>
 /// <param name="count">クエスト達成必要な数</param>
 /// <param name="info">任務情報(QuestInfoテーブルと対応)</param>
 /// <param name="isOver">進行中 or 完成</param>
 /// <param name="isAccept">実行中?</param>
 public Quest(int ID, int stepNow, int count, QuestInfo info, bool isOver,bool isAccept)
 {
     this.ID = ID;
     this.count = count;
     this.stepNow = stepNow > 0 ? stepNow : 1;
     this.info = info;
     this.isOver = isOver;
     this.isAccept = isAccept;
 }
Пример #26
0
 /// <summary>
 /// 查找一条任务的全部奖励物品
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static List <QuestAwardInfo> GetQuestGoods(QuestInfo info)
 {
     if (m_questgoods.ContainsKey(info.ID))
     {
         List <QuestAwardInfo> items = m_questgoods[info.ID];
         return(items);
     }
     return(null);
 }
Пример #27
0
        /// <inheritdoc />
        public void SendQuest(IPlayerEntity player, QuestInfo quest)
        {
            using var packet = new FFPacket();

            packet.StartNewMergedPacket(player.Id, SnapshotType.SETQUEST);
            quest.Serialize(packet);

            SendToPlayer(player, packet);
        }
Пример #28
0
        private void ParseQuests(IList <string> lines)
        {
            for (int i = 0; i < lines.Count; i++)
            {
                if (!lines[i].ToUpper().StartsWith(QuestKey))
                {
                    continue;
                }

                var loadedNPC = NPCObject.Get(LoadedObjectID);

                if (loadedNPC == null)
                {
                    return;
                }

                while (++i < lines.Count)
                {
                    if (lines[i].StartsWith("["))
                    {
                        return;
                    }
                    if (String.IsNullOrEmpty(lines[i]))
                    {
                        continue;
                    }

                    int.TryParse(lines[i], out int index);

                    if (index == 0)
                    {
                        continue;
                    }

                    QuestInfo info = Envir.GetQuestInfo(Math.Abs(index));

                    if (info == null)
                    {
                        return;
                    }

                    if (index > 0)
                    {
                        info.NpcIndex = LoadedObjectID;
                    }
                    else
                    {
                        info.FinishNpcIndex = LoadedObjectID;
                    }

                    if (loadedNPC.Quests.All(x => x != info))
                    {
                        loadedNPC.Quests.Add(info);
                    }
                }
            }
        }
Пример #29
0
 public void Init(Transform parent, QuestInfo questInfo)
 {
     this.CreateObjects();
     Transform transform = base.transform;
     transform.parent = parent;
     transform.localPosition = new Vector3(0f, 0f, -1000f);
     transform.localScale = Vector3.one;
     this.curQuestInfo = questInfo;
     this.Refresh();
 }
Пример #30
0
    public void onQuestComplete(NetworkMessage netMsg)
    {
        QuestInfo questInfo = netMsg.ReadMessage <QuestInfo>();
        Quest     quest     = (Quest)Tools.byteArrayToObject(questInfo.questClassInBytes);

        if (this.player.hasQuest(quest))
        {
            this.player.completeQuest(quest);
        }
    }
Пример #31
0
        /// <summary>
        /// Adds a quest to the table using the template.
        /// </summary>
        /// <param name="questInfo">Quest info.</param>
        protected virtual void AddQuestToTable(QuestInfo questInfo)
        {
            if ((questTable == null) || (questTemplate == null) || !questTemplate.ArePropertiesAssigned)
            {
                return;
            }

            // Try to use existing instance from unused list first:
            var existingChild = unusedQuestTemplateInstances.Find(x => x.heading.GetComponentInChildren <UnityEngine.UI.Text>() != null && string.Equals(x.heading.GetComponentInChildren <UnityEngine.UI.Text>().text, questInfo.Heading.text));

            if (existingChild != null)
            {
                unusedQuestTemplateInstances.Remove(existingChild);
                questTemplateInstances.Add(existingChild);
                existingChild.transform.SetSiblingIndex(siblingIndexCounter++);
                existingChild.description.text = questInfo.Description.text;
                existingChild.ClearQuestDetails();
                SetQuestDetails(existingChild, questInfo);
                return;
            }

            // Otherwise create a new one:
            // Instantiate a copy of the template:
            GameObject questGameObject = Instantiate(questTemplate.gameObject) as GameObject;

            if (questGameObject == null)
            {
                Debug.LogError(string.Format("{0}: {1} couldn't instantiate quest template", new object[] { DialogueDebug.Prefix, name }));
                return;
            }
            questGameObject.name = questInfo.Heading.text;
            questGameObject.transform.SetParent(questTable.transform, false);
            questGameObject.transform.SetSiblingIndex(siblingIndexCounter++);
            questGameObject.SetActive(true);
            UnityUIQuestTemplate questControl = questGameObject.GetComponent <UnityUIQuestTemplate>();

            if (questControl == null)
            {
                return;
            }
            questTemplateInstances.Add(questControl);
            questControl.Initialize();

            // Set the heading button:
            var questHeadingButton = questControl.heading;
            var heading            = questHeadingButton.GetComponentInChildren <UnityEngine.UI.Text>();

            if (heading != null)
            {
                heading.text = questInfo.Heading.text;
            }
            questHeadingButton.onClick.AddListener(() => ClickQuestFoldout(questInfo.Title));

            SetQuestDetails(questControl, questInfo);
        }
Пример #32
0
 public void Load(QuestSystemManager manager, QuestInfo info)
 {
     this.manager = manager;
     transform.parent = manager.transform;
     tasks = info.taskInfos;
     taskIndex = 0;
     reward = ((GameObject)Instantiate(_reward)).GetComponent<Reward>();
     reward.Load(this, info.rewardInfo);
     description = info.description;
     LoadNextTask();
 }
Пример #33
0
    public void onQuestTurnIn(NetworkMessage netMsg)
    {
        QuestInfo questInfo = netMsg.ReadMessage <QuestInfo>();
        Quest     quest     = (Quest)Tools.byteArrayToObject(questInfo.questClassInBytes);
        Quest     q         = this.player.lookupQuest(quest.getId());

        q.setStatus(e_QuestStatus.TURNED_IN);
        this.player.npcTalkingTo.GetComponent <NPCMain>().onQuestTurnIn(q);
        this.player.getQuestInformationData().removeQuestPanel(q);
        this.sendExpToServer(quest.expReward);
    }
Пример #34
0
    public void QuestCancle(string name)
    {
        QuestInfo index = questScript.FindNameToQuestInfo(name);

        if (index == null)
        {
            return;
        }
        questScript.RemoveQuest(index);
        Removequestlist(name);
    }
Пример #35
0
        public override void Register(QuestInfo rpQuest)
        {
            ApiService.SubscribeOnlyOnBeforeProcessStarted("api_req_kousyou/destroyitem2", rpInfo =>
            {
                ProgressInfo rProgressInfo;
                if (rpQuest.ID != 638 ||!QuestProgressService.Instance.Progresses.TryGetValue(rpQuest.ID, out rProgressInfo) || rProgressInfo.State != QuestState.Active)
                    return;

                rProgressInfo.Progress += rpInfo.Parameters["api_slotitem_ids"].Split(',')
                    .Select(r => KanColleGame.Current.Port.Equipment[int.Parse(r)]).Where(r => r.Info.Type == EquipmentType.AAGun).Count();
            });
        }
Пример #36
0
 public static void QuestBtnClicked(QuestInfo questInfo)
 {
     int questState = Globals.Instance.Player.GetQuestState(questInfo.ID);
     if (questState == 0)
     {
         GameUIQuestInformation.QuestGo(questInfo);
     }
     else if (questState == 1)
     {
         GameUIQuestInformation.SendTakeQuestReward(questInfo.ID);
     }
 }
Пример #37
0
    public void RemoveQuest(QuestInfo index)
    {
        if (questAcessList.Count >= 0)
        {
            playerQuestList[index.quest_code].quest_state  = QuestState.able;
            playerQuestList[index.quest_code].questItemCur = 0;
            questAcessList.Remove(index);

            networkRouter.PostRouter(PostType.PLAYER_QUEST_STATE_UPDATE, playerQuestList[index.quest_code]);
        }
        return;
    }
Пример #38
0
        public override void Register(QuestInfo rpQuest)
        {
            ApiService.Subscribe("api_req_practice/battle_result", r =>
            {
                ProgressInfo rProgressInfo;
                if (!QuestProgressService.Instance.Progresses.TryGetValue(rpQuest.ID, out rProgressInfo) || rProgressInfo.State != QuestState.Active)
                    return;

                if (rpQuest.ID == 303 || r.GetData<RawBattleResult>().Rank >= BattleRank.B)
                    rProgressInfo.Progress++;
            });
        }
Пример #39
0
 /// <summary>
 /// 任務をゲット
 /// </summary>
 /// <param name="info"></param>
 public bool AcceptQuest(QuestInfo info)
 {
     Quest quest;
     if (questAcceptList.TryGetValue(info.ID, out quest))
     {
         quest.isAccept = true;
     }
     else
     {
         questAcceptList.Add(info.ID, new Quest(info.ID, 1, 0, info, false));
         //TODO:サーバへ提出
     }
     return true;
 }
Пример #40
0
 private QuestSceneItem AddOneItem(QuestInfo qInfo)
 {
     GameObject original = Res.LoadGUI("GUI/QuestSceneItem");
     GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(original);
     gameObject.transform.parent = this.mQuestTable.gameObject.transform;
     gameObject.transform.localPosition = Vector3.zero;
     gameObject.transform.localScale = Vector3.one;
     QuestSceneItem questSceneItem = gameObject.AddComponent<QuestSceneItem>();
     QuestSceneItem expr_5A = questSceneItem;
     expr_5A.QuestItemClicked = (QuestSceneItem.QuestItemEvent)Delegate.Combine(expr_5A.QuestItemClicked, new QuestSceneItem.QuestItemEvent(this.OnQuestItemClicked));
     questSceneItem.InitQuestItem(qInfo);
     questSceneItem.RefreshQuestItem();
     return questSceneItem;
 }
        public override void Register(QuestInfo rpQuest)
        {
            base.Register(rpQuest);

            SessionService.Instance.Subscribe("api_req_map/start", r =>
            {
                ProgressInfo rProgressInfo;
                if (!QuestProgressService.Instance.Progresses.TryGetValue(rpQuest.ID, out rProgressInfo) || rProgressInfo.State != QuestState.Executing)
                    return;

                var rBits = new BitVector32(rProgressInfo.Progress);
                rBits[r_Sections[0]] = Math.Min(rBits[r_Sections[0]] + 1, 36);
                rProgressInfo.Progress = rBits.Data;

                UpdatePercentage(rProgressInfo, rBits);
            });
        }
Пример #42
0
        public override void Register(QuestInfo rpQuest)
        {
            var rBattleResultApis = new[]
            {
                "api_req_sortie/battleresult",
                "api_req_combined_battle/battleresult",
            };
            SessionService.Instance.Subscribe(rBattleResultApis, r =>
            {
                ProgressInfo rProgressInfo;
                if (!QuestProgressService.Instance.Progresses.TryGetValue(rpQuest.ID, out rProgressInfo) || rProgressInfo.State != QuestState.Executing)
                    return;

                Process(rProgressInfo, BattleInfo.Current, r.GetData<RawBattleResult>());

                rProgressInfo.Progress = Math.Min(rProgressInfo.Progress, rProgressInfo.Quest.Total);
            });
        }
Пример #43
0
        /// <summary>
        /// Adds a quest to the table using the template.
        /// </summary>
        /// <param name="questInfo">Quest info.</param>
        private void AddQuestToTable(QuestInfo questInfo, int questIndex)
        {
            if ((questTable == null) || (questTemplate == null) || !questTemplate.ArePropertiesAssigned) return;

            // Instantiate a copy of the template:
            GameObject questGameObject = Instantiate(questTemplate.gameObject) as GameObject;
            if (questGameObject == null) {
                Debug.LogError(string.Format("{0}: {1} couldn't instantiate quest template", new object[] { DialogueDebug.Prefix, name }));
            }
            questGameObject.name = questInfo.Heading.text;
            questGameObject.transform.SetParent(questTable.transform, false);
            questGameObject.SetActive(true);
            UnityUIQuestTemplate questControl = questGameObject.GetComponent<UnityUIQuestTemplate>();

            // Set the heading button:
            var questHeadingButton = questControl.heading;
            questHeadingButton.GetComponentInChildren<UnityEngine.UI.Text>().text = questInfo.Heading.text;
            questHeadingButton.onClick.AddListener(() => ClickQuestFoldout(questInfo.Title));

            // Set details if this is the selected quest:
            if (IsSelectedQuest(questInfo)) {

                // Set the description:
                if (questHeadingSource == QuestHeadingSource.Name) {
                    questControl.description.text = questInfo.Description.text;
                } else {
                    Tools.SetGameObjectActive(questControl.description, false);
                }

                // Set the entry description:
                if (questInfo.EntryStates.Length > 0) {
                    string entryDescription = string.Empty;
                    for (int i = 0; i < questInfo.Entries.Length; i++) {
                        if (questInfo.EntryStates[i] != QuestState.Unassigned) {
                            if (!string.IsNullOrEmpty(entryDescription)) {
                                entryDescription += "\n";
                            }
                            entryDescription += questInfo.Entries[i].text;
                        }
                    }
                    questControl.entryDescription.text = entryDescription;
                } else {
                    Tools.SetGameObjectActive(questControl.entryDescription, false);
                }

                UnityUIQuestTitle unityUIQuestTitle = null;

                // Set the track button:
                if (questControl.trackButton != null) {
                    unityUIQuestTitle = questControl.trackButton.gameObject.AddComponent<UnityUIQuestTitle>();
                    unityUIQuestTitle.questTitle = questInfo.Title;
                    questControl.trackButton.onClick.RemoveListener(() => ClickTrackQuestButton());
                    questControl.trackButton.onClick.AddListener(() => ClickTrackQuestButton());
                    Tools.SetGameObjectActive(questControl.trackButton, questInfo.Trackable);
                }

                // Set the abandon button:
                if (questControl.abandonButton != null) {
                    unityUIQuestTitle = questControl.abandonButton.gameObject.AddComponent<UnityUIQuestTitle>();
                    unityUIQuestTitle.questTitle = questInfo.Title;
                    questControl.abandonButton.onClick.RemoveListener(() => ClickAbandonQuestButton());
                    questControl.abandonButton.onClick.AddListener(() => ClickAbandonQuestButton());
                    Tools.SetGameObjectActive(questControl.abandonButton, questInfo.Abandonable);
                }

            } else {
                Tools.SetGameObjectActive(questControl.description, false);
                Tools.SetGameObjectActive(questControl.entryDescription, false);
                Tools.SetGameObjectActive(questControl.trackButton, false);
                Tools.SetGameObjectActive(questControl.abandonButton, false);
            }
        }
Пример #44
0
 public QuestInfoCache(QuestInfo info)
     : base(info)
 {
     Step = info.QuestStep;
     KillCount = info.KillCount;
     QuestMeter = info.QuestMeter;
     BonusCount = info.BonusCount;
     CreationTick = info.CreationTick;
 }
Пример #45
0
            public void Refresh(QuestInfo questinfo)
            {
                int curStep = Step;
                try
                {
                    State = questinfo.State;
                    Step = questinfo.QuestStep;
                    KillCount = questinfo.KillCount;
                    QuestMeter = questinfo.QuestMeter;
                    BonusCount = questinfo.BonusCount;
                    CreationTick = questinfo.CreationTick;

                    if (curStep != Step)
                    {
                        Logger.Write(LogLevel.Bounty, "Active Quest {2} Step Changed From {0} To {1}", curStep, Step, QuestSNO);
                        QuestStepChanged(QuestSNO, curStep, Step);

                    }
                }
                catch (Exception ex)
                {
                    Logger.Write(LogLevel.Bounty, "Safely handled updating quest info (qi) cache for entry {0}\r\n" +
                                                  "Ex: {1}\r\n{2}", QuestSNO, ex.Message,ex.StackTrace);
                }
            }
 private float QuestDescriptionHeight(QuestInfo questInfo)
 {
     questBodyStyle = UseGUIStyle(questBodyStyle, questBodyGuiStyleName, GUI.skin.label);
     if (questHeadingSource == QuestHeadingSource.Name) {
         return questBodyStyle.CalcHeight(new GUIContent(questInfo.Description.text), scrollView.contentWidth - (2 * padding));
     } else {
         return 0;
     }
 }
Пример #47
0
 public void SetQuest(QuestInfo info)
 {
     this.questInfo = info;
     this.myTextMesh.text = questInfo.YakuNum + str;
 }
Пример #48
0
 internal void EnableQuest(QuestInfo questInfo)
 {
     HasQuest = true;
     QuestInfo = questInfo;        
     QuestManager.EnableQuest(questInfo.QuestUID);
 }
Пример #49
0
 /// <summary>
 /// クエストの報酬を貰う
 /// </summary>
 /// <param name="award"></param>
 public void QuestAward(QuestInfo.Award award)
 {
     if (award.itemID >= 0)
     {
         GetItem(award.itemID);
     }
     GetMoney(award.money);
     ExpUp(award.EXP);
 }
Пример #50
0
		/// <summary>
		/// Adds a quest to the table using the template.
		/// </summary>
		/// <param name="questInfo">Quest info.</param>
		private void AddQuestToTable(QuestInfo questInfo) {
			if ((questTable == null) || (questTemplate == null)) return;
			GameObject child = NGUITools.AddChild(questTable.gameObject, questTemplate.gameObject);
			NGUIQuestTemplate item = child.GetComponent<NGUIQuestTemplate>();
			if ((item == null) || !item.ArePropertiesAssigned) {
				if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: {1} Not all properties are assigned in the template", DialogueDebug.Prefix, name));
				return;
			}
			NGUITools.SetActive(child, true);
			item.heading.text = questInfo.Heading.text;
			string fullDescription = string.Empty;
			if (questHeadingSource == QuestHeadingSource.Name) fullDescription += questInfo.Description.text;
			for (int i = 0; i < questInfo.Entries.Length; i++) {
				if (questInfo.EntryStates[i] != QuestState.Unassigned) {
					fullDescription += "\n" + questInfo.Entries[i].text;
				}
			}
			item.description.text = fullDescription;
			if (item.description.transform.parent != child) {
				TweenScale tweenScale = item.description.transform.parent.GetComponent<TweenScale>();
				if (tweenScale != null) NGUITools.SetActive(tweenScale.gameObject, false);
			}
			NGUIQuestTitle nguiQuestTitle = item.trackButton.gameObject.AddComponent<NGUIQuestTitle>();
			nguiQuestTitle.questTitle = questInfo.Title;
			UIEventListener.Get(item.trackButton.gameObject).onClick += OnTrackButtonClicked;
			NGUITools.SetActive(item.trackButton.gameObject, questInfo.Trackable);
			nguiQuestTitle = item.abandonButton.gameObject.AddComponent<NGUIQuestTitle>();
			nguiQuestTitle.questTitle = questInfo.Title;
			UIEventListener.Get(item.abandonButton.gameObject).onClick += OnAbandonButtonClicked;
			NGUITools.SetActive(item.abandonButton.gameObject, questInfo.Abandonable);
		}
 /// <summary>
 /// Computes the height of a quest heading, which is the height of the text or the height 
 /// of the active button, whichever is greater. This way headings will look similar to 
 /// the active/completed buttons (and will be tall enough if the skin has large buttons).
 /// </summary>
 /// <returns>
 /// The heading height.
 /// </returns>
 /// <param name='heading'>
 /// Heading.
 /// </param>
 private float QuestHeadingHeight(QuestInfo questInfo)
 {
     return Mathf.Max(activeButton.rect.height, GetQuestHeadingStyle(IsSelectedQuest(questInfo)).CalcHeight(new GUIContent(questInfo.Heading.text), scrollView.contentWidth - (2 * padding)));
 }
 public abstract void Register(QuestInfo rpQuest);
Пример #53
0
 private static void QuestGo(QuestInfo questInfo)
 {
     SceneInfo info = Globals.Instance.AttDB.SceneDict.GetInfo(questInfo.ID);
     if (info == null)
     {
         return;
     }
     if (info.Difficulty == 1 && Globals.Instance.Player.GetSceneScore(GameConst.GetInt32(109)) <= 0)
     {
         GameUIManager.mInstance.ShowMessageTip(Singleton<StringManager>.Instance.GetString("WorldMap_3"), 0f, 0f);
         return;
     }
     if (info.Difficulty == 9 && Globals.Instance.Player.GetSceneScore(GameConst.GetInt32(61)) <= 0)
     {
         GameUIManager.mInstance.ShowMessageTip(Singleton<StringManager>.Instance.GetString("WorldMap_6"), 0f, 0f);
         return;
     }
     GameUIManager.mInstance.uiState.PetSceneInfo = info;
     GameUIManager.mInstance.uiState.QuestSceneInfo = GameUIManager.mInstance.uiState.PetSceneInfo;
     GameUIManager.mInstance.ChangeSession<GUIWorldMap>(null, false, false);
 }
Пример #54
0
    // NPC 이름에 해당하는 대사들과 퀘스트 정보를 가져옴
    public void GetScript(string name)
    {
        List<Script> curScript = new List<Script>(); //현재 NPC의 대사를 저장
        isSpeak = true;

        // 이전에 대화를 하지 않는 NPC일 경우 대화를 위해 정보들을 가져옴
        if (!GetSpeakName(name))
        {
            for (int i = 0; i < scriptData.Count; i++)
            {
                if (scriptData[i].name == name && scriptData[i].scriptType == 0)
                {
                    // 대사 정보들을 저장
                    curScript.Add(new Script
                    {
                        name = name,
                        context = scriptData[i].context,
                        scriptType = scriptData[i].scriptType,
                        speaker = scriptData[i].speaker,
                    });
                    // 퀘스트 정보를 저장
                    questInfo = (new QuestInfo
                    {
                        questType = scriptData[0].questType,
                        targetName = scriptData[0].questTarget,
                        completNum = scriptData[0].completeNum,
                    });
                }
            }
            // NPC 이름과 퀘스트 달성 여부를 저장
            spokeNpc.Add(new SpokeNpc
            {
                NpcName = name,
                isQuestClear = false
            });

            QuestMgr.instance.GetQuestInfo(questInfo);
            StartCoroutine(ShowScript(curScript));
        }
        // 퀘스트 수락 후 완료 시
        else if (GetSpeakName(name) && isQuest)
        {
            for (int i = 0; i < scriptData.Count; i++)
            {
                if (scriptData[i].name == name && scriptData[i].scriptType == 1)
                {
                    // 대사 정보들을 저장
                    curScript.Add(new Script
                    {
                        name = name,
                        context = scriptData[i].context,
                        scriptType = scriptData[i].scriptType,
                        speaker = scriptData[i].speaker,
                    });
                }
            }
            // 퀘스트 완료후 퀘스트 달성 여부 수정 저장
            for(int i=0; i<spokeNpc.Count; i++)
            {
                if(spokeNpc[i].NpcName == name)
                {
                    spokeNpc[i].isQuestClear = true;
                }
            }
            isQuest = false;
            StartCoroutine(ShowScript(curScript));
        }
        else if (GetSpeakName(name) && !isQuest) 
        {
            Debug.Log("END SPEAK");
        }
    }
Пример #55
0
    public Dictionary<int, QuestInfo> LoadQuestList()
    {
        //if(questList!=null)
        //{
        //    return questList;
        //}
        //else
        //{
        string[] proArray;
        string[] dataArray = questListData.ToString().Split('\n');
        questList = new Dictionary<int, QuestInfo>();
        int maxIndex;

        for (int minIndex = 1; minIndex < dataArray.Length; minIndex++)
        {
            if (dataArray[minIndex] != "")
            {
                for (maxIndex = minIndex; maxIndex < dataArray.Length; maxIndex++)
                {
                    if (dataArray[maxIndex].Split(',')[0] != dataArray[minIndex].Split(',')[0])
                    {
                        break;
                    }
                }
                stepList = new List<QuestInfo.QuestStep>();
                for (int i = minIndex; i < maxIndex; i++)
                {
                    proArray = dataArray[i].Split(',');
                    stepList.Add(QuestInfo.makeStep(proArray[3], (QuestType)int.Parse(proArray[4]), int.Parse(proArray[5]), int.Parse(proArray[6]), int.Parse(proArray[7]), int.Parse(proArray[8]), int.Parse(proArray[9])));
                }
                proArray = dataArray[minIndex].Split(',');
                info = new QuestInfo(int.Parse(proArray[0]), proArray[1], proArray[2], stepList);
                questList.Add(info.ID, info);
                minIndex = maxIndex - 1;
            }
        }
        return questList;
        //}

    }
Пример #56
0
 private void OnQuestItemClicked(QuestInfo questInfo)
 {
     GameUIQuestInformation.GetInstance().Init(base.transform, questInfo);
 }
Пример #57
0
 private static void UpdateQuest()
 {
     Quest = ZetaDia.ActInfo.ActiveQuests.FirstOrDefault(q => q.QuestSNO == 405695);
 }
 private float QuestEntriesHeight(QuestInfo questInfo)
 {
     float height = 0;
     for (int i = 0; i < questInfo.Entries.Length; i++) {
         QuestState entryState = questInfo.EntryStates[i];
         GUIStyle questEntryStyle = GetQuestEntryStyle(entryState);
         if (entryState != QuestState.Unassigned) {
             string entryDescription = questInfo.Entries[i].text;
             height += questEntryStyle.CalcHeight(new GUIContent(entryDescription), scrollView.contentWidth - (2 * padding));
         }
     }
     return height;
 }
Пример #59
0
            public BountyInfoCache(QuestInfo quest)
            {
                try
                {
                    //Act = (Act)quest.QuestRecord.Act;
                    Act = Act.Invalid;
                    State = quest.State;
                    QuestSNO = quest.QuestSNO;

                }
                catch (Exception ex)
                {
                    Logger.DBLog.DebugFormat("Failure to create BountyInfoCache \r\n{0}\r\n{1}", ex.Message, ex.StackTrace);
                }
            }
Пример #60
0
 public void InitQuestItem(QuestInfo qInfo)
 {
     this.bg = base.transform.GetComponent<UISprite>();
     this.title = this.bg.transform.Find("quest").GetComponent<UILabel>();
     this.target = this.bg.transform.Find("questTXT").GetComponent<UILabel>();
     this.progress = base.transform.Find("Label").GetComponent<UILabel>();
     this.btnGo = base.transform.Find("GoBtn").gameObject;
     this.btnGoLb = this.btnGo.transform.Find("Label").GetComponent<UILabel>();
     this.btnReceive = base.transform.Find("ReceiveBtn").gameObject;
     Tools.SetParticleRQWithUIScale(this.btnReceive.transform.FindChild("Sprite/ui67").gameObject, 3100);
     this.Reward = base.transform.Find("Reward");
     Transform transform = base.transform.Find("IconBg");
     this.itemIcon = transform.transform.Find("itemIcon").GetComponent<UISprite>();
     this.petIcon = transform.transform.Find("petIcon").GetComponent<UISprite>();
     this.specialIcon = transform.transform.Find("specialIcon").GetComponent<UISprite>();
     this.Quality = transform.transform.Find("QualityMark").GetComponent<UISprite>();
     UIEventListener expr_189 = UIEventListener.Get(this.bg.gameObject);
     expr_189.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_189.onClick, new UIEventListener.VoidDelegate(this.OnQuestItemClicked));
     UIEventListener expr_1B5 = UIEventListener.Get(this.btnGo);
     expr_1B5.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1B5.onClick, new UIEventListener.VoidDelegate(this.OnQuestBtnClicked));
     UIEventListener expr_1E1 = UIEventListener.Get(this.btnReceive);
     expr_1E1.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1E1.onClick, new UIEventListener.VoidDelegate(this.OnQuestBtnClicked));
     this.questInfo = qInfo;
     this.isPlaying = false;
     this.itemIcon.gameObject.SetActive(false);
     this.petIcon.gameObject.SetActive(false);
     this.specialIcon.gameObject.SetActive(false);
     switch (this.questInfo.IconType)
     {
     case 0:
     {
         this.itemIcon.gameObject.SetActive(false);
         this.petIcon.gameObject.SetActive(false);
         this.specialIcon.gameObject.SetActive(false);
         SceneInfo info = Globals.Instance.AttDB.SceneDict.GetInfo(qInfo.ID);
         if (info != null)
         {
             MonsterInfo monsterInfo = null;
             for (int i = 2; i >= 0; i--)
             {
                 monsterInfo = Globals.Instance.AttDB.MonsterDict.GetInfo(info.Enemy[i]);
                 if (monsterInfo != null)
                 {
                     break;
                 }
             }
             if (monsterInfo != null)
             {
                 this.petIcon.spriteName = monsterInfo.Icon;
                 this.petIcon.gameObject.SetActive(true);
                 this.Quality.spriteName = Tools.GetItemQualityIcon(monsterInfo.Quality);
             }
             else
             {
                 global::Debug.LogErrorFormat("Can not find EQIcon_Boss Icon {0}", new object[]
                 {
                     this.questInfo.ID
                 });
             }
         }
         break;
     }
     case 1:
     {
         PetInfo info2 = Globals.Instance.AttDB.PetDict.GetInfo(this.questInfo.IconValue);
         if (info2 != null)
         {
             this.petIcon.spriteName = info2.Icon;
             this.petIcon.gameObject.SetActive(true);
             this.Quality.spriteName = Tools.GetItemQualityIcon(info2.Quality);
         }
         else
         {
             global::Debug.LogErrorFormat("Can not find EQIcon_Pet Icon {0} PetID = {1}", new object[]
             {
                 this.questInfo.ID,
                 this.questInfo.IconValue
             });
         }
         break;
     }
     case 2:
     {
         ItemInfo info3 = Globals.Instance.AttDB.ItemDict.GetInfo(this.questInfo.IconValue);
         if (info3 != null)
         {
             this.itemIcon.spriteName = info3.Icon;
             this.itemIcon.gameObject.SetActive(true);
             this.Quality.spriteName = Tools.GetItemQualityIcon(info3.Quality);
         }
         else
         {
             global::Debug.LogErrorFormat("Can not find EQIcon_Item Icon {0} ItemID = {1}", new object[]
             {
                 this.questInfo.ID,
                 this.questInfo.IconValue
             });
         }
         break;
     }
     default:
         this.specialIcon.gameObject.SetActive(true);
         this.Quality.spriteName = Tools.GetItemQualityIcon(2);
         break;
     }
     for (int j = 0; j < this.RewardItem.Length; j++)
     {
         if (this.RewardItem[j] != null)
         {
             UnityEngine.Object.Destroy(this.RewardItem[j]);
             this.RewardItem[j] = null;
         }
     }
     int k = 0;
     int num = 0;
     while (k < this.questInfo.RewardType.Count)
     {
         if (k < this.RewardItem.Length && this.questInfo.RewardType[k] != 0 && this.questInfo.RewardType[k] != 20)
         {
             this.RewardItem[num] = GameUITools.CreateReward(this.questInfo.RewardType[k], this.questInfo.RewardValue1[k], this.questInfo.RewardValue2[k], this.Reward, true, true, 36f, -7f, -2000f, 20f, 13f, 7f, 0);
             if (this.RewardItem[num] != null)
             {
                 this.RewardItem[num].transform.localPosition = new Vector3((float)(num * 112), 0f, 0f);
                 num++;
             }
         }
         k++;
     }
 }