Ejemplo n.º 1
0
        private void MsgBoxJumpToQuest(GameObject go)
        {
            QuestTypes gQuestType = this.g_quest_type;

            switch (gQuestType)
            {
            case QuestTypes.Event:
            case QuestTypes.Gps:
                this.trophy_window.ActivateOutputLinks(2006);
                break;

            case QuestTypes.Tower:
                this.trophy_window.ActivateOutputLinks(2026);
                break;

            default:
                if (gQuestType != QuestTypes.Multi)
                {
                    if (gQuestType != QuestTypes.Beginner)
                    {
                        this.trophy_window.ActivateOutputLinks(2002);
                        break;
                    }
                    goto case QuestTypes.Event;
                }
                else
                {
                    this.trophy_window.ActivateOutputLinks(2005);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void MsgBoxJumpToQuest(GameObject go)
        {
            QuestTypes gQuestType = this.g_quest_type;

            switch (gQuestType)
            {
            case QuestTypes.Event:
            case QuestTypes.Gps:
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                break;

            case QuestTypes.Tower:
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                break;

            default:
                if (gQuestType != QuestTypes.Multi)
                {
                    if (gQuestType == QuestTypes.Beginner)
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1027);
                        break;
                    }
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1001);
                    break;
                }
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 1005);
                break;
            }
        }
Ejemplo n.º 3
0
        public PlayerPartyTypes QuestToPartyIndex(QuestTypes type)
        {
            switch (type)
            {
            case QuestTypes.Multi:
                return(PlayerPartyTypes.Multiplay);

            case QuestTypes.Arena:
                return(PlayerPartyTypes.Arena);

            case QuestTypes.Free:
            case QuestTypes.Extra:
                return(PlayerPartyTypes.Event);

            case QuestTypes.Character:
                return(PlayerPartyTypes.Character);

            case QuestTypes.Tower:
                return(PlayerPartyTypes.Tower);

            case QuestTypes.VersusFree:
            case QuestTypes.VersusRank:
                return(PlayerPartyTypes.Versus);

            default:
                return(PlayerPartyTypes.Normal);
            }
        }
Ejemplo n.º 4
0
    public void makeNotCompatible(QuestTypes q1, QuestTypes q2)
    {
        compatabilityTable[(int)q1, (int)q2] = false;
        compatabilityTable[(int)q2, (int)q1] = false;

        // Debug.Log("disabled compatability between "+q1+" and " + q2);
    }
Ejemplo n.º 5
0
 public bool Deserialize(JSON_QuestCampaignChildParam json)
 {
     this.iname     = json.iname;
     this.scope     = (QuestCampaignScopes)json.scope;
     this.questType = (QuestTypes)json.quest_type;
     this.questMode = (QuestDifficulties)json.quest_mode;
     this.questId   = json.quest_id;
     this.unit      = json.unit;
     this.dropRate  = json.drop_rate;
     this.dropNum   = json.drop_num;
     this.expPlayer = json.exp_player;
     this.expUnit   = json.exp_unit;
     this.apRate    = json.ap_rate;
     this.parents   = new QuestCampaignParentParam[0];
     return(true);
 }
Ejemplo n.º 6
0
        private static void SetQuests(Fallout4ChecklistContext context)
        {
            QuestTypes = context.QuestTypes
                         .Include(x => x.Quests.Select(y => y.QuestStages))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.Armor.Select(a => a.Slots))))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.Armor.Select(a => a.Effects))))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.Companions)))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.NPCs)))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.OtherRewards)))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.Settlements)))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.Weapons)))
                         .Include(x => x.Quests.Select(y => y.QuestStages.Select(z => z.NextQuestStages)))
                         .OrderBy(x => x.DisplayOrder)
                         .ToList();

            Quests = QuestTypes.SelectMany(x => x.Quests).OrderBy(x => x.DisplayOrder).ToList();
        }
Ejemplo n.º 7
0
    private Quest generateQuestByType(List <GameObject> players, GameManager GM, QuestTypes currQuestType)
    {
        //Debug.Log("screening proccess worked, returning an atomic quest: " + currQuestType);
        if (currQuestType == QuestTypes.location)
        {
            return(new LocationQuest(players, GM));
        }
        if (currQuestType == QuestTypes.collect)
        {
            return(new CollectQuest(players, GM));
        }
        if (currQuestType == QuestTypes.kill)
        {
            return(new KillQuest(players, GM));
        }
        if (currQuestType == QuestTypes.survive)
        {
            return(new SurviveQuest(players, GM));
        }
        if (currQuestType == QuestTypes.touch)
        {
            return(new FollowQuest(players, GM));
        }
        if (currQuestType == QuestTypes.guard)
        {
            return(new GuardQuest(players, GM));
        }
        if (currQuestType == QuestTypes.boss)
        {
            return(new BossQuest(players, GM));
        }
        if (currQuestType == QuestTypes.jump)
        {
            return(new JumpQuest(players, GM));
        }
        if (currQuestType == QuestTypes.race)
        {
            return(new RacingQuest(players, GM));
        }

        Debug.Log("need to implement and assign quest type: " + currQuestType);
        return(new CollectQuest(players, GM));
    }
Ejemplo n.º 8
0
        private void OnTry()
        {
            TrophyParam dataOfClass = DataSource.FindDataOfClass <TrophyParam>(((Component)this).get_gameObject(), (TrophyParam)null);

            if (dataOfClass == null)
            {
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
            }
            else
            {
                QuestParam questParam = new QuestParam();
                PlayerData player     = MonoSingleton <GameManager> .Instance.Player;
                switch (dataOfClass.Objectives[0].type)
                {
                case TrophyConditionTypes.winquest:
                case TrophyConditionTypes.winquestsoldier:
                case TrophyConditionTypes.losequest:
                    QuestTypes quest_type1 = QuestTypes.Story;
                    if (!questParam.TransSectionGotoQuest(dataOfClass.Objectives[0].sval, out quest_type1, new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        this.g_quest_type = quest_type1;
                        break;
                    }
                    QuestTypes questTypes = quest_type1;
                    switch (questTypes)
                    {
                    case QuestTypes.Event:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                        return;

                    case QuestTypes.Tower:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1026);
                        return;

                    default:
                        if (questTypes == QuestTypes.Multi)
                        {
                            FlowNode_GameObject.ActivateOutputLinks((Component)this, 1005);
                            return;
                        }
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1001);
                        return;
                    }

                case TrophyConditionTypes.killenemy:
                case TrophyConditionTypes.getitem:
                case TrophyConditionTypes.playerlv:
                case TrophyConditionTypes.vip:
                case TrophyConditionTypes.stamina:
                case TrophyConditionTypes.card:
                case TrophyConditionTypes.review:
                case TrophyConditionTypes.followtwitter:
                case TrophyConditionTypes.unitlevel:
                case TrophyConditionTypes.evolutionnum:
                case TrophyConditionTypes.joblevel:
                case TrophyConditionTypes.logincount:
                case TrophyConditionTypes.fblogin:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
                    break;

                case TrophyConditionTypes.winelite:
                case TrophyConditionTypes.loseelite:
                    if (!questParam.TransSectionGotoElite(new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        break;
                    }
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1001);
                    break;

                case TrophyConditionTypes.winevent:
                case TrophyConditionTypes.loseevent:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                    break;

                case TrophyConditionTypes.gacha:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1000);
                    break;

                case TrophyConditionTypes.multiplay:
                case TrophyConditionTypes.winmulti:
                case TrophyConditionTypes.winmultimore:
                case TrophyConditionTypes.winmultiless:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1005);
                    break;

                case TrophyConditionTypes.ability:
                case TrophyConditionTypes.makeabilitylevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1002);
                    break;

                case TrophyConditionTypes.soubi:
                    if (player.CheckUnlock(UnlockTargets.EnhanceEquip))
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1003);
                        break;
                    }
                    LevelLock.ShowLockMessage(player.Lv, player.VipRank, UnlockTargets.EnhanceEquip);
                    break;

                case TrophyConditionTypes.buygold:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1004);
                    break;

                case TrophyConditionTypes.arena:
                case TrophyConditionTypes.winarena:
                case TrophyConditionTypes.losearena:
                    if (player.CheckUnlock(UnlockTargets.Arena))
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1008);
                        break;
                    }
                    LevelLock.ShowLockMessage(player.Lv, player.VipRank, UnlockTargets.Arena);
                    break;

                case TrophyConditionTypes.fggid:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                    break;

                case TrophyConditionTypes.upunitlevel:
                case TrophyConditionTypes.makeunitlevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1009);
                    break;

                case TrophyConditionTypes.unitequip:
                case TrophyConditionTypes.upjoblevel:
                case TrophyConditionTypes.makejoblevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1011);
                    break;

                case TrophyConditionTypes.limitbreak:
                case TrophyConditionTypes.evoltiontimes:
                case TrophyConditionTypes.changejob:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1012);
                    break;

                case TrophyConditionTypes.changeability:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1010);
                    break;

                case TrophyConditionTypes.buyatshop:
                    this.GotoShop(dataOfClass);
                    break;

                case TrophyConditionTypes.artifacttransmute:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1022);
                    break;

                case TrophyConditionTypes.artifactstrength:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1023);
                    break;

                case TrophyConditionTypes.artifactevolution:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1024);
                    break;

                case TrophyConditionTypes.wintower:
                case TrophyConditionTypes.losetower:
                    QuestTypes quest_type2 = QuestTypes.Story;
                    if (!questParam.TransSectionGotoTower(dataOfClass.Objectives[0].sval, out quest_type2))
                    {
                        break;
                    }
                    if (quest_type2 == QuestTypes.Event)
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                        break;
                    }
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1026);
                    break;

                case TrophyConditionTypes.vs:
                case TrophyConditionTypes.vswin:
                    if (player.CheckUnlock(UnlockTargets.MultiVS))
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1027);
                        break;
                    }
                    LevelLock.ShowLockMessage(player.Lv, player.VipRank, UnlockTargets.MultiVS);
                    break;

                default:
                    DebugUtility.Log(string.Format("未知の Trophy 条件 / {0}", (object)dataOfClass.Objectives[0].type));
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        public List <QuestParam> GetItemDropQuestList(ItemParam item, DateTime date_time)
        {
            List <QuestParam> questParamList1 = new List <QuestParam>();
            List <QuestParam> questParamList2 = new List <QuestParam>();

            this.CompleteLoading();
            using (List <SimpleQuestDropParam> .Enumerator enumerator = this.mSimpleQuestDrops.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SimpleQuestDropParam current = enumerator.Current;
                    if (current.item_iname == item.iname)
                    {
                        foreach (string iname in current.questlist)
                        {
                            QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(iname);

                            if (quest != null)
                            {
                                questParamList2.Add(quest);
                            }
                        }
                        break;
                    }
                }
            }
            using (List <QuestParam> .Enumerator enumerator1 = questParamList2.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    QuestParam current = enumerator1.Current;
                    if (!current.notSearch)
                    {
                        QuestTypes type = current.type;
                        switch (type)
                        {
                        case QuestTypes.Story:
                        case QuestTypes.Free:
                        case QuestTypes.Event:
label_15:
                            using (List <ItemParam> .Enumerator enumerator2 = this.GetQuestDropList(current.iname, date_time).GetEnumerator())
                            {
                                while (enumerator2.MoveNext())
                                {
                                    if (enumerator2.Current == item)
                                    {
                                        questParamList1.Add(current);
                                        break;
                                    }
                                }
                                continue;
                            }

                        default:
                            switch (type - (byte)10)
                            {
                            case QuestTypes.Story:
                            case QuestTypes.Multi:
                            case QuestTypes.Tutorial:
                                goto label_15;

                            default:
                                continue;
                            }
                        }
                    }
                }
            }
            return(questParamList1);
        }
Ejemplo n.º 10
0
        private void OnItemSelect(GameObject go)
        {
            TrophyParam dataOfClass = DataSource.FindDataOfClass <TrophyParam>(go, (TrophyParam)null);

            if (dataOfClass == null)
            {
                return;
            }
            TrophyState trophyCounter = MonoSingleton <GameManager> .Instance.Player.GetTrophyCounter(dataOfClass);

            if (!trophyCounter.IsEnded && trophyCounter.IsCompleted)
            {
                if (dataOfClass.IsInvisibleStamina() || !dataOfClass.IsAvailablePeriod(TimeManager.ServerTime, true))
                {
                    UIUtility.NegativeSystemMessage((string)null, LocalizedText.Get("sys.TROPHY_OUTDATED"), (UIUtility.DialogResultEvent)null, (GameObject)null, false, -1);
                    this.Refresh();
                }
                else
                {
                    GlobalVars.SelectedTrophy.Set(dataOfClass.iname);
                    RewardData rewardData = new RewardData(dataOfClass);
                    GlobalVars.LastReward.Set(rewardData);
                    GlobalVars.UnitGetReward = new UnitGetParam(rewardData.Items.ToArray());
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
                }
            }
            else
            {
                QuestParam questParam = new QuestParam();
                switch (dataOfClass.Objectives[0].type)
                {
                case TrophyConditionTypes.winquest:
                case TrophyConditionTypes.playerlv:
                case TrophyConditionTypes.winquestsoldier:
                case TrophyConditionTypes.losequest:
                    QuestTypes quest_type1 = QuestTypes.Story;
                    if (!questParam.TransSectionGotoQuest(dataOfClass.Objectives[0].sval, out quest_type1, new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        this.g_quest_type = quest_type1;
                        break;
                    }
                    QuestTypes questTypes = quest_type1;
                    switch (questTypes)
                    {
                    case QuestTypes.Event:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                        return;

                    case QuestTypes.Tower:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1026);
                        return;

                    default:
                        if (questTypes == QuestTypes.Multi)
                        {
                            FlowNode_GameObject.ActivateOutputLinks((Component)this, 1005);
                            return;
                        }
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1001);
                        return;
                    }

                case TrophyConditionTypes.winelite:
                case TrophyConditionTypes.loseelite:
                    if (!questParam.TransSectionGotoElite(new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        this.g_quest_type = QuestTypes.Story;
                        break;
                    }
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1001);
                    break;

                case TrophyConditionTypes.winevent:
                case TrophyConditionTypes.loseevent:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                    break;

                case TrophyConditionTypes.gacha:
                case TrophyConditionTypes.collectunits:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1000);
                    break;

                case TrophyConditionTypes.multiplay:
                case TrophyConditionTypes.winmulti:
                case TrophyConditionTypes.winmultimore:
                case TrophyConditionTypes.winmultiless:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1005);
                    break;

                case TrophyConditionTypes.ability:
                case TrophyConditionTypes.changeability:
                case TrophyConditionTypes.makeabilitylevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                    break;

                case TrophyConditionTypes.soubi:
                    this.GotoEquip();
                    break;

                case TrophyConditionTypes.buygold:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1004);
                    break;

                case TrophyConditionTypes.arena:
                case TrophyConditionTypes.winarena:
                case TrophyConditionTypes.losearena:
                    this.GotoArena();
                    break;

                case TrophyConditionTypes.review:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1029);
                    break;

                case TrophyConditionTypes.fggid:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1009);
                    break;

                case TrophyConditionTypes.unitlevel:
                case TrophyConditionTypes.evolutionnum:
                case TrophyConditionTypes.joblevel:
                case TrophyConditionTypes.upunitlevel:
                case TrophyConditionTypes.makeunitlevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                    break;

                case TrophyConditionTypes.unitequip:
                case TrophyConditionTypes.upjoblevel:
                case TrophyConditionTypes.makejoblevel:
                case TrophyConditionTypes.totaljoblv11:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                    break;

                case TrophyConditionTypes.limitbreak:
                case TrophyConditionTypes.evoltiontimes:
                case TrophyConditionTypes.changejob:
                case TrophyConditionTypes.totalunitlvs:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                    break;

                case TrophyConditionTypes.buyatshop:
                    this.GotoShop(dataOfClass);
                    break;

                case TrophyConditionTypes.artifacttransmute:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1021);
                    break;

                case TrophyConditionTypes.artifactstrength:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1021);
                    break;

                case TrophyConditionTypes.artifactevolution:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1021);
                    break;

                case TrophyConditionTypes.wintower:
                case TrophyConditionTypes.losetower:
                    QuestTypes quest_type2 = QuestTypes.Tower;
                    if (!questParam.TransSectionGotoTower(dataOfClass.Objectives[0].sval, out quest_type2))
                    {
                        break;
                    }
                    if (quest_type2 == QuestTypes.Event)
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                        break;
                    }
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1026);
                    break;

                case TrophyConditionTypes.vs:
                case TrophyConditionTypes.vswin:
                    this.GotoVersus();
                    break;

                case TrophyConditionTypes.fblogin:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1040);
                    break;
                }
            }
        }
Ejemplo n.º 11
0
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 0:
                GameManager instance = MonoSingleton <GameManager> .Instance;
                ((Behaviour)this).set_enabled(true);
                if ((long)GlobalVars.BtlID != 0L)
                {
                    if ((instance.Player.TutorialFlags & 1L) == 0L)
                    {
                        this.ActivateOutputLinks(3);
                        break;
                    }
                    QuestTypes questType = GlobalVars.QuestType;
                    switch (questType)
                    {
                    case QuestTypes.Tower:
                        UIUtility.ConfirmBox(LocalizedText.Get("sys.CONFIRM_RESUMEQUEST"), new UIUtility.DialogResultEvent(this.OnTowerResumeAccept), new UIUtility.DialogResultEvent(this.OnTowerResumeCancel), (GameObject)null, false, -1, (string)null, (string)null);
                        return;

                    case QuestTypes.VersusFree:
                    case QuestTypes.VersusRank:
                        UIUtility.ConfirmBox(LocalizedText.Get("sys.MULTI_VERSUS_CONFIRM_RESUMEQUEST"), new UIUtility.DialogResultEvent(this.OnVersusAccept), new UIUtility.DialogResultEvent(this.OnVersusResumeCancel), (GameObject)null, false, -1, (string)null, (string)null);
                        return;

                    case QuestTypes.MultiTower:
                        UIUtility.ConfirmBox(LocalizedText.Get("sys.MULTI_TOWER_CONFIRM_RESUMEQUEST"), new UIUtility.DialogResultEvent(this.OnMultiTowerAccept), new UIUtility.DialogResultEvent(this.OnMultiTowerResumeCancel), (GameObject)null, false, -1, (string)null, (string)null);
                        return;

                    default:
                        if (questType == QuestTypes.Multi)
                        {
                            UIUtility.ConfirmBox(LocalizedText.Get("sys.MULTI_CONFIRM_RESUMEQUEST"), new UIUtility.DialogResultEvent(this.OnMultiResumeAccept), new UIUtility.DialogResultEvent(this.OnMultiResumeCancel), (GameObject)null, false, -1, (string)null, (string)null);
                            return;
                        }
                        UIUtility.ConfirmBox(LocalizedText.Get("sys.CONFIRM_RESUMEQUEST"), new UIUtility.DialogResultEvent(this.OnResumeAccept), new UIUtility.DialogResultEvent(this.OnResumeCancel), (GameObject)null, false, -1, (string)null, (string)null);
                        return;
                    }
                }
                else
                {
                    BattleCore.RemoveSuspendData();
                    if ((instance.Player.TutorialFlags & 1L) != 0L)
                    {
                        GlobalVars.IsTutorialEnd = true;
                        if (MonoSingleton <GameManager> .Instance.AuthStatus == ReqFgGAuth.eAuthStatus.Synchronized)
                        {
                            this.LoadStartScene();
                            break;
                        }
                        this.ActivateOutputLinks(18);
                        break;
                    }
                    instance.UpdateTutorialStep();
                    if (instance.TutorialStep == 0 && GameUtility.IsDebugBuild)
                    {
                        if (GlobalVars.DebugIsPlayTutorial)
                        {
                            this.PlayTutorial();
                            break;
                        }
                        this.mSkipTutorial = true;
                        this.CompleteTutorial();
                        break;
                    }
                    this.PlayTutorial();
                    break;
                }

            case 1:
                MonoSingleton <GameManager> .Instance.CompleteTutorialStep();

                this.PlayTutorial();
                break;

            case 7:
                this.ClearMultiResumeData();
                break;

            case 8:
                this.ClearTowerResumeData();
                break;

            case 10:
                this.PlayTutorial();
                break;

            case 16:
                this.ClearVersusResumeData();
                break;

            case 17:
                this.LoadStartScene();
                break;

            case 20:
                this.ClearMultiTowerResumeData();
                break;
            }
        }
Ejemplo n.º 12
0
    public Quest createRandomQuest(List <GameObject> players, GameManager GM,
                                   bool allowAND = true, QuestTypes[] usedQuests = null)
    {
        //return new ORQuest(new FollowQuest(players, GM), new SurviveQuest(players, GM));
        playerCount = players.Count;
        counter++;
        if (counter == 1)
        {
            return(new ANDQuest(new RacingQuest(players, GM), new JumpQuest(players, GM)));
        }
        if (counter == 2)
        {
            return(new ORQuest(new FollowQuest(players, GM), new KillQuest(players, GM)));
        }
        if (counter == 3)
        {
            return(new ANDQuest(new BossQuest(players, GM), new NOTQuest(new SurviveQuest(players, GM))));
        }
        if (counter == 4)
        {
            return(new CompoundQuest(new CollectQuest(players, GM), new KillQuest(players, GM), new BossQuest(players, GM)));
        }
        if (counter == 5)
        {
            return(new ANDQuest(new LocationQuest(players, GM), new GuardQuest(players, GM)));
        }
        if (counter == 6)
        {
            return(new ANDQuest(new RacingQuest(players, GM), new NOTQuest(new JumpQuest(players, GM))));
        }
        if (counter == 7)
        {
            return(new ORQuest(new BossQuest(players, GM), new NOTQuest(new KillQuest(players, GM))));
        }
        if (counter == 8)
        {
            return(new CompoundQuest(new CollectQuest(players, GM), new KillQuest(players, GM), new SurviveQuest(players, GM)));
        }

        //return new RacingQuest(players, GM);
        //return new SurviveQuest(players, GM);
        //return new GuardQuest(players, GM);
        //return new FollowQuest(players, GM);
        //return new BossQuest(players, GM);
        if (allowAND)
        {
            // questindex = 0;
            //return new CompoundQuest(players, GM);

            //return new ANDQuest(players, GM);
            //return new NOTQuest( new KillQuest(players, GM) );
        }
        if (questindex == 0)
        {
            questindex++;
            return(new GuardQuest(players, GM));
        }
        else if (questindex == 1)
        {
            questindex++;
            return(new CollectQuest(players, GM));
        }
        else if (questindex == 2)
        {
            questindex++;
            return(new SurviveQuest(players, GM));
        }



        float rand            = (float)new sysRand().NextDouble();
        bool  choseANDORQuest = true;

        if (rand < 0.2f)
        {
            choseANDORQuest = false;     //low chance of atomic quest (20%)
        }
        if (allowAND && choseANDORQuest) //the quest should be AND/OR/Compound
        //Debug.Log("creating random AND/OR/Compound quest");
        {
            int randType = new sysRand().Next(0, 3);

            if (randType == 0)
            {
                return(new ANDQuest(players, GM));
            }
            else if (randType == 1)
            {
                return(new ORQuest(players, GM));
            }
            else if (randType == 2)
            {
                return(new CompoundQuest(players, GM));
            }
            else
            {
                Debug.Log("overflow in chosing AND/OR/CompoundQuest");
            }
        }
        else    //can be anything other than (AND/OR/Compound)
                //Debug.Log("creating random atomic quest");

        {
            QuestTypes[] availableTypes = findAvailableTypes(usedQuests);//available quests other than AND/OR/NOT/Compound
            string       typesS         = "";
            foreach (QuestTypes qt in availableTypes)
            {
                typesS += "" + qt + ", ";
            }
            //Debug.Log("available types: " + typesS);
            //int randIndex = Random.Range(0, availableTypes.Length);
            int        randIndex     = new sysRand().Next(0, availableTypes.Length);
            QuestTypes currQuestType = availableTypes[randIndex];

            Quest chosenQuest = generateQuestByType(players, GM, currQuestType);

            //rand = Random.Range(0f, 1f);

            rand = (float)new sysRand().NextDouble();
            //Debug.Log("rand: "+rand);
            if (rand < 0.2f)  //make a not quest
            {
                chosenQuest = new NOTQuest(chosenQuest);
            }



            return(chosenQuest);
        }
        //if execution reaches this point then we wern't able to create the quest

        Debug.Log("quest creation by table failed, returning to default behaviur");


        Quest createdQuest = null;

        //createdQuest = new LocationQuest(players, GM);
        //createdQuest = new CollectQuest(players, GM);
        //createdQuest = new KillQuest(players, GM);
        createdQuest = new BossQuest(players, GM);

        /*
         *      int randomInt = Random.Range(0, 5);
         *
         *      switch (randomInt) {
         *          case 0:
         *              createdQuest = new LocationQuest(players,GM);
         *              break;
         *          case 1:
         *              createdQuest = new KillQuest(players, GM);
         *              break;
         *          case 2:
         *              createdQuest = new SurviveQuest(players, GM);
         *              break;
         *          case 3:
         *              createdQuest = new CondQuest(players, GM);
         *              break;
         *          case 4:
         *              createdQuest = new ANDQuest(players, GM);
         *              break;
         *          case 5:
         *              createdQuest = new ORQuest(players, GM);
         *              break;
         *
         *      }
         */
        if (createdQuest == null)
        {
            Debug.Log("couldn't create quest, returning null quest");
        }
        return(createdQuest);
    }
Ejemplo n.º 13
0
 public void SetType(QuestTypes type)
 {
     QuestType = type;
 }
Ejemplo n.º 14
0
        public static float GetQuestModifier(this HeroClasses heroClass, QuestTypes questType)
        {
            float modifier = 0.5f;

            switch (questType)
            {
            case QuestTypes.ASSASSINATION:
                if (heroClass == HeroClasses.WARRIOR)
                {
                    modifier = 0.4f;
                }
                if (heroClass == HeroClasses.HUNTER)
                {
                    modifier = 0.75f;
                }
                if (heroClass == HeroClasses.SORCERER)
                {
                    modifier = 0.2f;
                }
                if (heroClass == HeroClasses.ROGUE)
                {
                    modifier = 1f;
                }
                break;

            case QuestTypes.ITEM_DELIVERY:
                if (heroClass == HeroClasses.WARRIOR)
                {
                    modifier = 0.4f;
                }
                if (heroClass == HeroClasses.HUNTER)
                {
                    modifier = 0.75f;
                }
                if (heroClass == HeroClasses.SORCERER)
                {
                    modifier = 0.5f;
                }
                if (heroClass == HeroClasses.ROGUE)
                {
                    modifier = 0.5f;
                }
                break;

            case QuestTypes.ITEM_GATHERING:
                if (heroClass == HeroClasses.WARRIOR)
                {
                    modifier = 0.1f;
                }
                if (heroClass == HeroClasses.HUNTER)
                {
                    modifier = 1f;
                }
                if (heroClass == HeroClasses.SORCERER)
                {
                    modifier = 0.8f;
                }
                if (heroClass == HeroClasses.ROGUE)
                {
                    modifier = 0.25f;
                }
                break;

            case QuestTypes.MONSTER_HUNTING:
                if (heroClass == HeroClasses.WARRIOR)
                {
                    modifier = 1;
                }
                if (heroClass == HeroClasses.HUNTER)
                {
                    modifier = 0.5f;
                }
                if (heroClass == HeroClasses.SORCERER)
                {
                    modifier = 0.75f;
                }
                if (heroClass == HeroClasses.ROGUE)
                {
                    modifier = 0.25f;
                }
                break;

            default:
                throw new System.Exception("Quest modifier not defined for quest type " + questType.ToString());
            }

            return(modifier.Map(0, 1, 0.8f, 1.2f));
        }
Ejemplo n.º 15
0
        private void OnItemSelect(GameObject go)
        {
            TrophyParam dataOfClass = DataSource.FindDataOfClass <TrophyParam>(go, (TrophyParam)null);

            if (dataOfClass == null)
            {
                return;
            }
            TrophyState trophyCounter = MonoSingleton <GameManager> .Instance.Player.GetTrophyCounter(dataOfClass, true);

            if (!trophyCounter.IsEnded && trophyCounter.IsCompleted)
            {
                if (dataOfClass.IsInvisibleStamina() || !dataOfClass.IsAvailablePeriod(TimeManager.ServerTime, true))
                {
                    UIUtility.NegativeSystemMessage((string)null, LocalizedText.Get("sys.TROPHY_OUTDATED"), (UIUtility.DialogResultEvent)null, (GameObject)null, false, -1);
                    this.Refresh();
                }
                else
                {
                    GlobalVars.SelectedTrophy.Set(dataOfClass.iname);
                    RewardData rewardData = new RewardData(dataOfClass);
                    GlobalVars.LastReward.Set(rewardData);
                    GlobalVars.UnitGetReward = new UnitGetParam(rewardData.Items.ToArray());
                    this.trophy_window.ActivateOutputLinks(2000);
                }
            }
            else
            {
                QuestParam questParam = new QuestParam();
                switch (dataOfClass.Objectives[0].type)
                {
                case TrophyConditionTypes.winquest:
                case TrophyConditionTypes.playerlv:
                case TrophyConditionTypes.winquestsoldier:
                case TrophyConditionTypes.losequest:
                case TrophyConditionTypes.damage_over:
                case TrophyConditionTypes.complete_all_quest_mission:
                case TrophyConditionTypes.has_gold_over:
                case TrophyConditionTypes.complete_all_quest_mission_total:
                case TrophyConditionTypes.complete_all_mission_count:
                case TrophyConditionTypes.complete_story_mission_count:
                    QuestTypes quest_type1 = QuestTypes.Story;
                    if (!questParam.TransSectionGotoQuest(dataOfClass.Objectives[0].sval_base, out quest_type1, new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        break;
                    }
                    switch (quest_type1)
                    {
                    case QuestTypes.Multi:
                    case QuestTypes.MultiGps:
                        this.trophy_window.ActivateOutputLinks(2005);
                        return;

                    case QuestTypes.Event:
                    case QuestTypes.Gps:
                        this.trophy_window.ActivateOutputLinks(2006);
                        return;

                    case QuestTypes.Character:
                        this.trophy_window.ActivateOutputLinks(2032);
                        return;

                    case QuestTypes.Tower:
                        this.trophy_window.ActivateOutputLinks(2026);
                        return;

                    case QuestTypes.Beginner:
                        this.trophy_window.ActivateOutputLinks(2033);
                        return;

                    default:
                        this.trophy_window.ActivateOutputLinks(2002);
                        return;
                    }

                case TrophyConditionTypes.winelite:
                case TrophyConditionTypes.loseelite:
                    if (!questParam.TransSectionGotoElite(new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        break;
                    }
                    this.trophy_window.ActivateOutputLinks(2002);
                    break;

                case TrophyConditionTypes.winevent:
                case TrophyConditionTypes.loseevent:
                case TrophyConditionTypes.exclear_fire:
                case TrophyConditionTypes.exclear_water:
                case TrophyConditionTypes.exclear_wind:
                case TrophyConditionTypes.exclear_thunder:
                case TrophyConditionTypes.exclear_light:
                case TrophyConditionTypes.exclear_dark:
                case TrophyConditionTypes.exclear_fire_nocon:
                case TrophyConditionTypes.exclear_water_nocon:
                case TrophyConditionTypes.exclear_wind_nocon:
                case TrophyConditionTypes.exclear_thunder_nocon:
                case TrophyConditionTypes.exclear_light_nocon:
                case TrophyConditionTypes.exclear_dark_nocon:
                case TrophyConditionTypes.complete_event_mission_count:
                    questParam.GotoEventListQuest((string)null, (string)null);
                    this.trophy_window.ActivateOutputLinks(2006);
                    break;

                case TrophyConditionTypes.gacha:
                case TrophyConditionTypes.collectunits:
                    this.trophy_window.ActivateOutputLinks(2001);
                    break;

                case TrophyConditionTypes.multiplay:
                case TrophyConditionTypes.winmulti:
                case TrophyConditionTypes.winmultimore:
                case TrophyConditionTypes.winmultiless:
                    this.trophy_window.ActivateOutputLinks(2005);
                    break;

                case TrophyConditionTypes.ability:
                case TrophyConditionTypes.changeability:
                case TrophyConditionTypes.makeabilitylevel:
                    this.trophy_window.ActivateOutputLinks(2025);
                    break;

                case TrophyConditionTypes.soubi:
                    this.GotoEquip();
                    break;

                case TrophyConditionTypes.buygold:
                    this.trophy_window.ActivateOutputLinks(2003);
                    break;

                case TrophyConditionTypes.arena:
                case TrophyConditionTypes.winarena:
                case TrophyConditionTypes.losearena:
                case TrophyConditionTypes.becomearenarank:
                case TrophyConditionTypes.overarenarank:
                    this.GotoArena();
                    break;

                case TrophyConditionTypes.review:
                    this.trophy_window.ActivateOutputLinks(2029);
                    break;

                case TrophyConditionTypes.fggid:
                    this.trophy_window.ActivateOutputLinks(2008);
                    break;

                case TrophyConditionTypes.unitlevel:
                case TrophyConditionTypes.evolutionnum:
                case TrophyConditionTypes.joblevel:
                case TrophyConditionTypes.upunitlevel:
                case TrophyConditionTypes.makeunitlevel:
                    this.trophy_window.ActivateOutputLinks(2025);
                    break;

                case TrophyConditionTypes.unitequip:
                case TrophyConditionTypes.upjoblevel:
                case TrophyConditionTypes.makejoblevel:
                case TrophyConditionTypes.totaljoblv11:
                    this.trophy_window.ActivateOutputLinks(2025);
                    break;

                case TrophyConditionTypes.limitbreak:
                case TrophyConditionTypes.evoltiontimes:
                case TrophyConditionTypes.changejob:
                case TrophyConditionTypes.totalunitlvs:
                    this.trophy_window.ActivateOutputLinks(2025);
                    break;

                case TrophyConditionTypes.buyatshop:
                    this.GotoShop(dataOfClass);
                    break;

                case TrophyConditionTypes.artifacttransmute:
                case TrophyConditionTypes.artifactstrength:
                case TrophyConditionTypes.artifactevolution:
                case TrophyConditionTypes.upartifactlevel:
                case TrophyConditionTypes.makeartifactlevel:
                    this.trophy_window.ActivateOutputLinks(2021);
                    break;

                case TrophyConditionTypes.wintower:
                case TrophyConditionTypes.losetower:
                case TrophyConditionTypes.tower:
                case TrophyConditionTypes.overtowerscore:
                    QuestTypes quest_type2 = QuestTypes.Tower;
                    if (!questParam.TransSectionGotoTower(dataOfClass.Objectives[0].sval_base, out quest_type2))
                    {
                        break;
                    }
                    QuestTypes questTypes = quest_type2;
                    switch (questTypes)
                    {
                    case QuestTypes.Gps:
                        this.trophy_window.ActivateOutputLinks(2006);
                        return;

                    case QuestTypes.Beginner:
                        this.trophy_window.ActivateOutputLinks(2033);
                        return;

                    default:
                        if (questTypes != QuestTypes.Event)
                        {
                            this.trophy_window.ActivateOutputLinks(2026);
                            return;
                        }
                        goto case QuestTypes.Gps;
                    }

                case TrophyConditionTypes.vs:
                case TrophyConditionTypes.vswin:
                case TrophyConditionTypes.overvsrankfloor:
                    this.GotoVersus();
                    break;

                case TrophyConditionTypes.winstory_extra:
                    if (!questParam.TransSectionGotoStoryExtra(new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        break;
                    }
                    this.trophy_window.ActivateOutputLinks(2002);
                    break;

                case TrophyConditionTypes.multitower_help:
                case TrophyConditionTypes.multitower:
                    this.GotoMultiTower();
                    break;

                case TrophyConditionTypes.read_tips:
                case TrophyConditionTypes.read_tips_count:
                    this.GotoBeginnerTop();
                    break;

                case TrophyConditionTypes.up_conceptcard_level:
                case TrophyConditionTypes.up_conceptcard_level_target:
                case TrophyConditionTypes.limitbreak_conceptcard:
                case TrophyConditionTypes.limitbreak_conceptcard_target:
                case TrophyConditionTypes.up_conceptcard_trust:
                case TrophyConditionTypes.up_conceptcard_trust_target:
                case TrophyConditionTypes.max_conceptcard_trust:
                    this.trophy_window.ActivateOutputLinks(2035);
                    break;

                case TrophyConditionTypes.unlock_tobira_total:
                case TrophyConditionTypes.unlock_tobira_unit:
                case TrophyConditionTypes.envy_unlock_unit:
                case TrophyConditionTypes.sloth_unlock_unit:
                case TrophyConditionTypes.lust_unlock_unit:
                case TrophyConditionTypes.greed_unlock_unit:
                case TrophyConditionTypes.wrath_unlock_unit:
                case TrophyConditionTypes.gluttonny_unlock_unit:
                case TrophyConditionTypes.pride_unlock_unit:
                    this.trophy_window.ActivateOutputLinks(2025);
                    break;

                case TrophyConditionTypes.send_present:
                    this.trophy_window.ActivateOutputLinks(2039);
                    break;

                case TrophyConditionTypes.complete_ordeal_mission_count:
                case TrophyConditionTypes.clear_ordeal:
                    this.trophy_window.ActivateOutputLinks(2036);
                    break;

                case TrophyConditionTypes.view_news:
                    this.trophy_window.ActivateOutputLinks(2038);
                    break;
                }
            }
        }
Ejemplo n.º 16
0
        public void LoadFromDB()
        {
            // Pool templates
            {
                uint oldMSTime = Time.GetMSTime();

                SQLResult result = DB.World.Query("SELECT entry, max_limit FROM pool_template");
                if (result.IsEmpty())
                {
                    mPoolTemplate.Clear();
                    Log.outInfo(LogFilter.ServerLoading, "Loaded 0 object pools. DB table `pool_template` is empty.");
                    return;
                }

                uint count = 0;
                do
                {
                    uint pool_id = result.Read <uint>(0);

                    PoolTemplateData pPoolTemplate = new PoolTemplateData();
                    pPoolTemplate.MaxLimit = result.Read <uint>(1);
                    mPoolTemplate[pool_id] = pPoolTemplate;
                    ++count;
                }while (result.NextRow());

                Log.outInfo(LogFilter.ServerLoading, "Loaded {0} objects pools in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
            }

            // Creatures

            Log.outInfo(LogFilter.ServerLoading, "Loading Creatures Pooling Data...");
            {
                uint oldMSTime = Time.GetMSTime();

                //                                                 1       2         3
                SQLResult result = DB.World.Query("SELECT guid, pool_entry, chance FROM pool_creature");

                if (result.IsEmpty())
                {
                    Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creatures in  pools. DB table `pool_creature` is empty.");
                }
                else
                {
                    uint count = 0;
                    do
                    {
                        ulong guid    = result.Read <ulong>(0);
                        uint  pool_id = result.Read <uint>(1);
                        float chance  = result.Read <float>(2);

                        CreatureData data = Global.ObjectMgr.GetCreatureData(guid);
                        if (data == null)
                        {
                            Log.outError(LogFilter.Sql, "`pool_creature` has a non existing creature spawn (GUID: {0}) defined for pool id ({1}), skipped.", guid, pool_id);
                            continue;
                        }
                        if (!mPoolTemplate.ContainsKey(pool_id))
                        {
                            Log.outError(LogFilter.Sql, "`pool_creature` pool id ({0}) is not in `pool_template`, skipped.", pool_id);
                            continue;
                        }
                        if (chance < 0 || chance > 100)
                        {
                            Log.outError(LogFilter.Sql, "`pool_creature` has an invalid chance ({0}) for creature guid ({1}) in pool id ({2}), skipped.", chance, guid, pool_id);
                            continue;
                        }
                        PoolTemplateData pPoolTemplate = mPoolTemplate[pool_id];
                        PoolObject       plObject      = new PoolObject(guid, chance);

                        if (!mPoolCreatureGroups.ContainsKey(pool_id))
                        {
                            mPoolCreatureGroups[pool_id] = new PoolGroup <Creature>();
                        }

                        PoolGroup <Creature> cregroup = mPoolCreatureGroups[pool_id];
                        cregroup.SetPoolId(pool_id);
                        cregroup.AddEntry(plObject, pPoolTemplate.MaxLimit);

                        mCreatureSearchMap.Add(guid, pool_id);
                        ++count;
                    }while (result.NextRow());

                    Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creatures in pools in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
                }
            }

            // Gameobjects

            Log.outInfo(LogFilter.ServerLoading, "Loading Gameobject Pooling Data...");
            {
                uint oldMSTime = Time.GetMSTime();

                //                                                 1        2         3
                SQLResult result = DB.World.Query("SELECT guid, pool_entry, chance FROM pool_gameobject");

                if (result.IsEmpty())
                {
                    Log.outInfo(LogFilter.ServerLoading, "Loaded 0 gameobjects in  pools. DB table `pool_gameobject` is empty.");
                }
                else
                {
                    uint count = 0;
                    do
                    {
                        ulong guid    = result.Read <ulong>(0);
                        uint  pool_id = result.Read <uint>(1);
                        float chance  = result.Read <float>(2);

                        GameObjectData data = Global.ObjectMgr.GetGOData(guid);
                        if (data == null)
                        {
                            Log.outError(LogFilter.Sql, "`pool_gameobject` has a non existing gameobject spawn (GUID: {0}) defined for pool id ({1}), skipped.", guid, pool_id);
                            continue;
                        }

                        GameObjectTemplate goinfo = Global.ObjectMgr.GetGameObjectTemplate(data.id);
                        if (goinfo.type != GameObjectTypes.Chest &&
                            goinfo.type != GameObjectTypes.FishingHole &&
                            goinfo.type != GameObjectTypes.GatheringNode &&
                            goinfo.type != GameObjectTypes.Goober)
                        {
                            Log.outError(LogFilter.Sql, "`pool_gameobject` has a not lootable gameobject spawn (GUID: {0}, type: {1}) defined for pool id ({2}), skipped.", guid, goinfo.type, pool_id);
                            continue;
                        }

                        if (!mPoolTemplate.ContainsKey(pool_id))
                        {
                            Log.outError(LogFilter.Sql, "`pool_gameobject` pool id ({0}) is not in `pool_template`, skipped.", pool_id);
                            continue;
                        }

                        if (chance < 0 || chance > 100)
                        {
                            Log.outError(LogFilter.Sql, "`pool_gameobject` has an invalid chance ({0}) for gameobject guid ({1}) in pool id ({2}), skipped.", chance, guid, pool_id);
                            continue;
                        }

                        PoolTemplateData pPoolTemplate = mPoolTemplate[pool_id];
                        PoolObject       plObject      = new PoolObject(guid, chance);

                        if (!mPoolGameobjectGroups.ContainsKey(pool_id))
                        {
                            mPoolGameobjectGroups[pool_id] = new PoolGroup <GameObject>();
                        }

                        PoolGroup <GameObject> gogroup = mPoolGameobjectGroups[pool_id];
                        gogroup.SetPoolId(pool_id);
                        gogroup.AddEntry(plObject, pPoolTemplate.MaxLimit);

                        mGameobjectSearchMap.Add(guid, pool_id);
                        ++count;
                    }while (result.NextRow());

                    Log.outInfo(LogFilter.ServerLoading, "Loaded {0} gameobject in pools in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
                }
            }

            // Pool of pools

            Log.outInfo(LogFilter.ServerLoading, "Loading Mother Pooling Data...");
            {
                uint oldMSTime = Time.GetMSTime();

                //                                                  1        2            3
                SQLResult result = DB.World.Query("SELECT pool_id, mother_pool, chance FROM pool_pool");

                if (result.IsEmpty())
                {
                    Log.outInfo(LogFilter.ServerLoading, "Loaded 0 pools in pools");
                }
                else
                {
                    uint count = 0;
                    do
                    {
                        uint  child_pool_id  = result.Read <uint>(0);
                        uint  mother_pool_id = result.Read <uint>(1);
                        float chance         = result.Read <float>(2);

                        if (!mPoolTemplate.ContainsKey(mother_pool_id))
                        {
                            Log.outError(LogFilter.Sql, "`pool_pool` mother_pool id ({0}) is not in `pool_template`, skipped.", mother_pool_id);
                            continue;
                        }
                        if (!mPoolTemplate.ContainsKey(child_pool_id))
                        {
                            Log.outError(LogFilter.Sql, "`pool_pool` included pool_id ({0}) is not in `pool_template`, skipped.", child_pool_id);
                            continue;
                        }
                        if (mother_pool_id == child_pool_id)
                        {
                            Log.outError(LogFilter.Sql, "`pool_pool` pool_id ({0}) includes itself, dead-lock detected, skipped.", child_pool_id);
                            continue;
                        }
                        if (chance < 0 || chance > 100)
                        {
                            Log.outError(LogFilter.Sql, "`pool_pool` has an invalid chance ({0}) for pool id ({1}) in mother pool id ({2}), skipped.", chance, child_pool_id, mother_pool_id);
                            continue;
                        }
                        PoolTemplateData pPoolTemplateMother = mPoolTemplate[mother_pool_id];
                        PoolObject       plObject            = new PoolObject(child_pool_id, chance);

                        if (!mPoolPoolGroups.ContainsKey(mother_pool_id))
                        {
                            mPoolPoolGroups[mother_pool_id] = new PoolGroup <Pool>();
                        }

                        PoolGroup <Pool> plgroup = mPoolPoolGroups[mother_pool_id];
                        plgroup.SetPoolId(mother_pool_id);
                        plgroup.AddEntry(plObject, pPoolTemplateMother.MaxLimit);

                        mPoolSearchMap.Add(child_pool_id, mother_pool_id);
                        ++count;
                    }while (result.NextRow());

                    Log.outInfo(LogFilter.ServerLoading, "Loaded {0} pools in mother pools in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
                }
            }

            Log.outInfo(LogFilter.ServerLoading, "Loading Quest Pooling Data...");
            {
                uint oldMSTime = Time.GetMSTime();

                PreparedStatement stmt   = DB.World.GetPreparedStatement(WorldStatements.SEL_QUEST_POOLS);
                SQLResult         result = DB.World.Query(stmt);

                if (result.IsEmpty())
                {
                    Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quests in pools");
                }
                else
                {
                    List <uint> creBounds;
                    List <uint> goBounds;

                    Dictionary <uint, QuestTypes> poolTypeMap = new Dictionary <uint, QuestTypes>();
                    uint count = 0;
                    do
                    {
                        uint entry   = result.Read <uint>(0);
                        uint pool_id = result.Read <uint>(1);

                        if (!poolTypeMap.ContainsKey(pool_id))
                        {
                            poolTypeMap[pool_id] = 0;
                        }

                        Quest quest = Global.ObjectMgr.GetQuestTemplate(entry);
                        if (quest == null)
                        {
                            Log.outError(LogFilter.Sql, "`pool_quest` has a non existing quest template (Entry: {0}) defined for pool id ({1}), skipped.", entry, pool_id);
                            continue;
                        }

                        if (!mPoolTemplate.ContainsKey(pool_id))
                        {
                            Log.outError(LogFilter.Sql, "`pool_quest` pool id ({0}) is not in `pool_template`, skipped.", pool_id);
                            continue;
                        }

                        if (!quest.IsDailyOrWeekly())
                        {
                            Log.outError(LogFilter.Sql, "`pool_quest` has an quest ({0}) which is not daily or weekly in pool id ({1}), use ExclusiveGroup instead, skipped.", entry, pool_id);
                            continue;
                        }

                        if (poolTypeMap[pool_id] == QuestTypes.None)
                        {
                            poolTypeMap[pool_id] = quest.IsDaily() ? QuestTypes.Daily : QuestTypes.Weekly;
                        }

                        QuestTypes currType = quest.IsDaily() ? QuestTypes.Daily : QuestTypes.Weekly;

                        if (poolTypeMap[pool_id] != currType)
                        {
                            Log.outError(LogFilter.Sql, "`pool_quest` quest {0} is {1} but pool ({2}) is specified for {3}, mixing not allowed, skipped.",
                                         entry, currType, pool_id, poolTypeMap[pool_id]);
                            continue;
                        }

                        creBounds = mQuestCreatureRelation.LookupByKey(entry);
                        goBounds  = mQuestGORelation.LookupByKey(entry);

                        if (creBounds.Empty() && goBounds.Empty())
                        {
                            Log.outError(LogFilter.Sql, "`pool_quest` lists entry ({0}) as member of pool ({1}) but is not started anywhere, skipped.", entry, pool_id);
                            continue;
                        }

                        PoolTemplateData pPoolTemplate = mPoolTemplate[pool_id];
                        PoolObject       plObject      = new PoolObject(entry, 0.0f);

                        if (!mPoolQuestGroups.ContainsKey(pool_id))
                        {
                            mPoolQuestGroups[pool_id] = new PoolGroup <Quest>();
                        }

                        PoolGroup <Quest> questgroup = mPoolQuestGroups[pool_id];
                        questgroup.SetPoolId(pool_id);
                        questgroup.AddEntry(plObject, pPoolTemplate.MaxLimit);

                        mQuestSearchMap.Add(entry, pool_id);
                        ++count;
                    }while (result.NextRow());

                    Log.outInfo(LogFilter.ServerLoading, "Loaded {0} quests in pools in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
                }
            }

            // The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks
            Log.outInfo(LogFilter.ServerLoading, "Starting objects pooling system...");
            {
                uint oldMSTime = Time.GetMSTime();

                SQLResult result = DB.World.Query("SELECT DISTINCT pool_template.entry, pool_pool.pool_id, pool_pool.mother_pool FROM pool_template" +
                                                  " LEFT JOIN game_event_pool ON pool_template.entry=game_event_pool.pool_entry" +
                                                  " LEFT JOIN pool_pool ON pool_template.entry=pool_pool.pool_id WHERE game_event_pool.pool_entry IS NULL");

                if (result.IsEmpty())
                {
                    Log.outInfo(LogFilter.ServerLoading, "Pool handling system initialized, 0 pools spawned.");
                }
                else
                {
                    uint count = 0;
                    do
                    {
                        uint pool_entry   = result.Read <uint>(0);
                        uint pool_pool_id = result.Read <uint>(1);

                        if (!CheckPool(pool_entry))
                        {
                            if (pool_pool_id != 0)
                            {
                                // The pool is a child pool in pool_pool table. Ideally we should remove it from the pool handler to ensure it never gets spawned,
                                // however that could recursively invalidate entire chain of mother pools. It can be done in the future but for now we'll do nothing.
                                Log.outError(LogFilter.Sql, "Pool Id {0} has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id {1} and cannot be safely removed.", pool_entry, result.Read <uint>(2));
                            }
                            else
                            {
                                Log.outError(LogFilter.Sql, "Pool Id {0} has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry);
                            }
                            continue;
                        }

                        // Don't spawn child pools, they are spawned recursively by their parent pools
                        if (pool_pool_id == 0)
                        {
                            SpawnPool(pool_entry);
                            count++;
                        }
                    }while (result.NextRow());

                    Log.outDebug(LogFilter.Pool, "Pool handling system initialized, {0} pools spawned in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
                }
            }
        }
Ejemplo n.º 17
0
        private void OnClickTry()
        {
            TrophyParam dataOfClass = DataSource.FindDataOfClass <TrophyParam>(((Component)this).get_gameObject(), (TrophyParam)null);

            if (dataOfClass == null)
            {
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
            }
            else
            {
                QuestParam questParam = new QuestParam();
                PlayerData player     = MonoSingleton <GameManager> .Instance.Player;
                switch (dataOfClass.Objectives[0].type)
                {
                case TrophyConditionTypes.winquest:
                case TrophyConditionTypes.winquestsoldier:
                case TrophyConditionTypes.losequest:
                case TrophyConditionTypes.damage_over:
                case TrophyConditionTypes.complete_all_quest_mission:
                case TrophyConditionTypes.complete_all_quest_mission_total:
                case TrophyConditionTypes.complete_all_mission_count:
                case TrophyConditionTypes.complete_story_mission_count:
                    QuestTypes quest_type1 = QuestTypes.Story;
                    if (!questParam.TransSectionGotoQuest(dataOfClass.Objectives[0].sval_base, out quest_type1, new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        break;
                    }
                    QuestTypes questTypes1 = quest_type1;
                    switch (questTypes1)
                    {
                    case QuestTypes.Event:
                    case QuestTypes.Gps:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                        return;

                    case QuestTypes.Tower:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                        return;

                    case QuestTypes.Beginner:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1027);
                        return;

                    case QuestTypes.MultiGps:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1005);
                        return;

                    default:
                        if (questTypes1 != QuestTypes.Multi)
                        {
                            FlowNode_GameObject.ActivateOutputLinks((Component)this, 1001);
                            return;
                        }
                        goto case QuestTypes.MultiGps;
                    }

                case TrophyConditionTypes.killenemy:
                case TrophyConditionTypes.getitem:
                case TrophyConditionTypes.playerlv:
                case TrophyConditionTypes.vip:
                case TrophyConditionTypes.stamina:
                case TrophyConditionTypes.card:
                case TrophyConditionTypes.review:
                case TrophyConditionTypes.followtwitter:
                case TrophyConditionTypes.fggid:
                case TrophyConditionTypes.unitlevel:
                case TrophyConditionTypes.evolutionnum:
                case TrophyConditionTypes.joblevel:
                case TrophyConditionTypes.logincount:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
                    break;

                case TrophyConditionTypes.winelite:
                case TrophyConditionTypes.loseelite:
                    if (!questParam.TransSectionGotoElite(new UIUtility.DialogResultEvent(this.MsgBoxJumpToQuest)))
                    {
                        break;
                    }
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1001);
                    break;

                case TrophyConditionTypes.winevent:
                case TrophyConditionTypes.loseevent:
                case TrophyConditionTypes.exclear_fire:
                case TrophyConditionTypes.exclear_water:
                case TrophyConditionTypes.exclear_wind:
                case TrophyConditionTypes.exclear_thunder:
                case TrophyConditionTypes.exclear_light:
                case TrophyConditionTypes.exclear_dark:
                case TrophyConditionTypes.exclear_fire_nocon:
                case TrophyConditionTypes.exclear_water_nocon:
                case TrophyConditionTypes.exclear_wind_nocon:
                case TrophyConditionTypes.exclear_thunder_nocon:
                case TrophyConditionTypes.exclear_light_nocon:
                case TrophyConditionTypes.exclear_dark_nocon:
                    questParam.GotoEventListQuest((string)null, (string)null);
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                    break;

                case TrophyConditionTypes.gacha:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1000);
                    break;

                case TrophyConditionTypes.multiplay:
                case TrophyConditionTypes.winmulti:
                case TrophyConditionTypes.winmultimore:
                case TrophyConditionTypes.winmultiless:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1005);
                    break;

                case TrophyConditionTypes.ability:
                case TrophyConditionTypes.makeabilitylevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1002);
                    break;

                case TrophyConditionTypes.soubi:
                    if (player.CheckUnlock(UnlockTargets.EnhanceEquip))
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1003);
                        break;
                    }
                    LevelLock.ShowLockMessage(player.Lv, player.VipRank, UnlockTargets.EnhanceEquip);
                    break;

                case TrophyConditionTypes.buygold:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1004);
                    break;

                case TrophyConditionTypes.arena:
                case TrophyConditionTypes.winarena:
                case TrophyConditionTypes.losearena:
                    if (player.CheckUnlock(UnlockTargets.Arena))
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1008);
                        break;
                    }
                    LevelLock.ShowLockMessage(player.Lv, player.VipRank, UnlockTargets.Arena);
                    break;

                case TrophyConditionTypes.upunitlevel:
                case TrophyConditionTypes.makeunitlevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1009);
                    break;

                case TrophyConditionTypes.unitequip:
                case TrophyConditionTypes.upjoblevel:
                case TrophyConditionTypes.makejoblevel:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1011);
                    break;

                case TrophyConditionTypes.limitbreak:
                case TrophyConditionTypes.evoltiontimes:
                case TrophyConditionTypes.changejob:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1012);
                    break;

                case TrophyConditionTypes.changeability:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1010);
                    break;

                case TrophyConditionTypes.buyatshop:
                    this.GotoShop(dataOfClass);
                    break;

                case TrophyConditionTypes.artifacttransmute:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1022);
                    break;

                case TrophyConditionTypes.artifactstrength:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1023);
                    break;

                case TrophyConditionTypes.artifactevolution:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1024);
                    break;

                case TrophyConditionTypes.wintower:
                case TrophyConditionTypes.losetower:
                    QuestTypes quest_type2 = QuestTypes.Story;
                    if (!questParam.TransSectionGotoTower(dataOfClass.Objectives[0].sval_base, out quest_type2))
                    {
                        break;
                    }
                    QuestTypes questTypes2 = quest_type2;
                    switch (questTypes2)
                    {
                    case QuestTypes.Gps:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                        return;

                    case QuestTypes.Beginner:
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1027);
                        return;

                    default:
                        if (questTypes2 != QuestTypes.Event)
                        {
                            FlowNode_GameObject.ActivateOutputLinks((Component)this, 1025);
                            return;
                        }
                        goto case QuestTypes.Gps;
                    }

                case TrophyConditionTypes.vs:
                case TrophyConditionTypes.vswin:
                    if (player.CheckUnlock(UnlockTargets.MultiVS))
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 1026);
                        break;
                    }
                    LevelLock.ShowLockMessage(player.Lv, player.VipRank, UnlockTargets.MultiVS);
                    break;

                case TrophyConditionTypes.read_tips:
                case TrophyConditionTypes.read_tips_count:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1028);
                    break;

                case TrophyConditionTypes.up_conceptcard_level:
                case TrophyConditionTypes.up_conceptcard_level_target:
                case TrophyConditionTypes.limitbreak_conceptcard:
                case TrophyConditionTypes.limitbreak_conceptcard_target:
                case TrophyConditionTypes.up_conceptcard_trust:
                case TrophyConditionTypes.up_conceptcard_trust_target:
                case TrophyConditionTypes.max_conceptcard_trust:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1029);
                    break;

                case TrophyConditionTypes.unlock_tobira_total:
                case TrophyConditionTypes.unlock_tobira_unit:
                case TrophyConditionTypes.envy_unlock_unit:
                case TrophyConditionTypes.sloth_unlock_unit:
                case TrophyConditionTypes.lust_unlock_unit:
                case TrophyConditionTypes.greed_unlock_unit:
                case TrophyConditionTypes.wrath_unlock_unit:
                case TrophyConditionTypes.gluttonny_unlock_unit:
                case TrophyConditionTypes.pride_unlock_unit:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1012);
                    break;

                case TrophyConditionTypes.send_present:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1032);
                    break;

                case TrophyConditionTypes.complete_event_mission_count:
                    questParam.GotoEventListQuest((string)null, (string)null);
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1007);
                    break;

                case TrophyConditionTypes.complete_ordeal_mission_count:
                case TrophyConditionTypes.clear_ordeal:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1030);
                    break;

                case TrophyConditionTypes.view_news:
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 1031);
                    break;

                default:
                    DebugUtility.Log(string.Format("未知の Trophy 条件 / {0}", (object)dataOfClass.Objectives[0].type));
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
                    break;
                }
            }
        }