Ejemplo n.º 1
0
    private bool createBattleRequest()
    {
        if (m_QuestBuild != null)
        {
            if (m_NextChainPartyIndex != 0)
            {
                //敵進化あり
                BattleParam.m_BattleRequest = new BattleReq();
                ServerDataDefine.PacketStructQuest2BuildBattle battle_param = InGameUtil.GetQuest2BuildBattle(m_QuestBuild, m_NextChainPartyIndex);

                BattleParam.m_BattleRequest.SetupBattleReq(0,
                                                           false,
                                                           m_NextChainTurnOffset,
                                                           false,
                                                           true,
                                                           m_QuestBuild,
                                                           battle_param);

                m_NextChainPartyIndex = BattleParam.m_BattleRequest.m_QuestBuildBattle.chain;
                m_NextChainTurnOffset = BattleParam.m_BattleRequest.m_QuestBuildBattle.chain_turn_offset;
            }
            else
            {
                m_QuestBuild = null;
                m_EnemyPartyIndex++;
            }
        }

        if (m_QuestBuild == null && m_EnemyPartyIndex < m_EnemyPartyIDs.Length)
        {
            TemplateList <ServerDataDefine.PacketStructQuest2BuildBattle> acQuestBuildBattle = new TemplateList <ServerDataDefine.PacketStructQuest2BuildBattle>();
            TemplateList <ServerDataDefine.PacketStructQuest2BuildDrop>   acQuestBuildDrop   = new TemplateList <ServerDataDefine.PacketStructQuest2BuildDrop>();
            acQuestBuildBattle.Alloc(64);

            MasterDataEnemyGroup enemy_group = BattleParam.m_MasterDataCache.useEnemyGroup((uint)m_EnemyPartyIDs[m_EnemyPartyIndex]);

            int battle_id = CreateQuestBuildBattle(0, ref acQuestBuildBattle, ref acQuestBuildDrop, enemy_group);

            // 敵情報.
            m_QuestBuild             = new ServerDataDefine.PacketStructQuest2Build();
            m_QuestBuild.list_drop   = acQuestBuildDrop.ToArray();
            m_QuestBuild.list_battle = acQuestBuildBattle.ToArray();

            // ヘイト情報付加
            for (int idx = 0; idx < m_QuestBuild.list_battle.Length; idx++)
            {
                ServerDataDefine.PacketStructQuest2BuildBattle battle_build = m_QuestBuild.list_battle[idx];
                if (battle_build != null)
                {
                    battle_build.hate = new ServerDataDefine.PacketStructQuest2Hate();
                    battle_build.hate.hate_initial       = 1000;
                    battle_build.hate.hate_given_damage1 = 1000;
                    battle_build.hate.hate_given_damage2 = 800;
                    battle_build.hate.hate_given_damage3 = 600;
                    battle_build.hate.hate_given_damage4 = 400;
                    battle_build.hate.hate_given_damage5 = 200;
                    battle_build.hate.hate_heal1         = 500;
                    battle_build.hate.hate_heal2         = 400;
                    battle_build.hate.hate_heal3         = 300;
                    battle_build.hate.hate_heal4         = 200;
                    battle_build.hate.hate_heal5         = 100;
                    battle_build.hate.hate_rate_fire     = 100;
                    battle_build.hate.hate_rate_water    = 100;
                    battle_build.hate.hate_rate_wind     = 100;
                    battle_build.hate.hate_rate_light    = 100;
                    battle_build.hate.hate_rate_dark     = 100;
                    battle_build.hate.hate_rate_naught   = 100;

                    battle_build.hate.hate_rate_race1  = 100;
                    battle_build.hate.hate_rate_race2  = 100;
                    battle_build.hate.hate_rate_race3  = 100;
                    battle_build.hate.hate_rate_race4  = 100;
                    battle_build.hate.hate_rate_race5  = 100;
                    battle_build.hate.hate_rate_race6  = 100;
                    battle_build.hate.hate_rate_race7  = 100;
                    battle_build.hate.hate_rate_race8  = 100;
                    battle_build.hate.hate_rate_race9  = 100;
                    battle_build.hate.hate_rate_race10 = 100;
                }
            }

            ServerDataDefine.PacketStructQuest2BuildBattle battle_param = InGameUtil.GetQuest2BuildBattle(m_QuestBuild, battle_id);

            BattleParam.m_BattleRequest = new BattleReq();
            BattleParam.m_BattleRequest.SetupBattleReq(0,
                                                       false,
                                                       0,
                                                       false,
                                                       false,
                                                       m_QuestBuild,
                                                       battle_param);

            m_NextChainPartyIndex = BattleParam.m_BattleRequest.m_QuestBuildBattle.chain;
            m_NextChainTurnOffset = BattleParam.m_BattleRequest.m_QuestBuildBattle.chain_turn_offset;
        }

        return(m_QuestBuild != null);
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (DebugOptionInGame.Instance == null)
        {
            return;
        }

        if (m_TestGameManager == null)
        {
            return;
        }

        switch (m_Status)
        {
        case eStatus.API_QUEST_START:
        {
            if (DebugOptionInGame.Instance.inGameDebugDO.m_UseAPI == true)
            {
                m_HelperIndex = RandManager.GetRand(0, (uint)(UserDataAdmin.Instance.m_StructHelperList.Length - 1));
                PacketStructFriend cHelper = null;
                if (UserDataAdmin.Instance.m_StructFriendList.Length > 0 &&
                    UserDataAdmin.Instance.m_StructFriendList[0] != null)
                {
                    cHelper = UserDataAdmin.Instance.m_StructFriendList[0];
                }
                else if (UserDataAdmin.Instance.m_StructHelperList.Length > 0)
                {
                    cHelper = UserDataAdmin.Instance.m_StructHelperList[m_HelperIndex];
                }
                {
                    ServerDataUtilSend.SendPacketAPI_Quest2Start(
                        DebugOptionInGame.Instance.inGameDebugDO.m_QuestId,
                        0,
                        cHelper.user_id,
                        cHelper.unit,
                        false,
                        UserDataAdmin.Instance.m_StructPlayer.unit_party_current,
                        0,
                        0,
                        null,
                        false
                        )
                    .setSuccessAction(_data =>
                        {
                            if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build == null)
                            {
                                SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build = new SceneGoesParamToQuest2Build();
                            }
                            SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild = _data.GetResult <RecvQuest2Start>().result.quest;
                            m_Status = eStatus.DATA_CREATE;
                        })
                    .setErrorAction(data =>
                        {
                            Debug.LogErrorFormat("[TestGameMain] Quest2Start API Error [{0}] : QuestId = {1}", data.m_PacketCode.ToString(), DebugOptionInGame.Instance.inGameDebugDO.m_QuestId.ToString());
                            m_TestGameManager.Message_text = "API Error\r\n [" + data.m_PacketCode.ToString() + "]";
                        })
                    .SendStart();
                    m_Status = eStatus.NONE;
                }
            }
            else
            {
                if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build == null)
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build = new SceneGoesParamToQuest2Build();
                }
                {
                    MasterDataQuest2        masterDataQuest2 = MasterDataUtil.GetQuest2ParamFromID(DebugOptionInGame.Instance.inGameDebugDO.m_QuestId);
                    PacketStructQuest2Build cQuestBuild      = new PacketStructQuest2Build();
                    int floor_size = 2;
                    //----------------------------------------
                    // 最終的な構築情報を格納する領域を確保
                    //----------------------------------------
                    TemplateList <PacketStructQuest2BuildBattle> acQuestBuildBattle = new TemplateList <PacketStructQuest2BuildBattle>();
                    TemplateList <PacketStructQuest2BuildDrop>   acQuestBuildDrop   = new TemplateList <PacketStructQuest2BuildDrop>();
                    acQuestBuildBattle.Alloc(64);

                    int nFloorDataAccess = 0;
                    cQuestBuild.boss = new int[floor_size];

                    for (int i = 0; i < floor_size; i++)
                    {
                        nFloorDataAccess = (i - 1);
                        if (nFloorDataAccess < 0)
                        {
                            continue;
                        }
                        //----------------------------------------
                        //	0番目要素ダミーデータの入力
                        //----------------------------------------
                        PacketStructQuest2BuildBattle build_param_battle = new PacketStructQuest2BuildBattle();
                        if (build_param_battle != null)
                        {
                            build_param_battle.unique_id         = 0;
                            build_param_battle.enemy_list        = null;
                            build_param_battle.drop_list         = null;
                            build_param_battle.chain             = 0;
                            build_param_battle.chain_turn_offset = 0;
                            build_param_battle.bgm_id            = 0;

                            acQuestBuildBattle.Add(build_param_battle);
                        }

                        //----------------------------------------
                        // 戦闘情報を設定
                        //----------------------------------------
                        int battle_num = MasterDataUtil.GetQuest2BattleNum(masterDataQuest2.fix_id);
                        for (int j = 0; j < battle_num; j++)
                        {
                            uint enemy_group_id = MasterDataUtil.GetQuest2EnemyGroup(masterDataQuest2.fix_id, j);
                            if (enemy_group_id == 0)
                            {
                                continue;
                            }

                            MasterDataEnemyGroup acMasterGroupEnemy = ServerFogery_GetEnemyGroupFromID(enemy_group_id);
                            if (acMasterGroupEnemy == null)
                            {
                                Debug.LogError("EnemyGroup not found id = " + enemy_group_id);
                                continue;
                            }
                            CreateQuestBuildBattle(
                                i
                                , ref acQuestBuildBattle
                                , ref acQuestBuildDrop
                                , acMasterGroupEnemy
                                );
                        }
                        //----------------------------------------
                        // ボス戦闘情報を設定
                        //----------------------------------------
                        cQuestBuild.boss[i] = 0;
                        if (masterDataQuest2.boss_group_id > 0)
                        {
                            MasterDataEnemyGroup cBossEnemyGroup = ServerFogery_GetEnemyGroupFromID(masterDataQuest2.boss_group_id);
                            if (cBossEnemyGroup != null)
                            {
                                cQuestBuild.boss[i] = CreateQuestBuildBattle(
                                    i
                                    , ref acQuestBuildBattle
                                    , ref acQuestBuildDrop
                                    , cBossEnemyGroup
                                    );
                            }
                            else
                            {
                                Debug.LogError("EnemyGroup not found Boss id = " + masterDataQuest2.boss_group_id);
                            }
                        }
                    }

                    TemplateList <MasterDataParamEnemy>       e_param_list     = new TemplateList <MasterDataParamEnemy>();
                    TemplateList <MasterDataEnemyActionParam> e_act_param_list = new TemplateList <MasterDataEnemyActionParam>();
                    TemplateList <MasterDataEnemyActionTable> e_act_table_list = new TemplateList <MasterDataEnemyActionTable>();

                    for (int i = 0; i < acQuestBuildBattle.m_BufferSize; i++)
                    {
                        if (acQuestBuildBattle[i] == null)
                        {
                            continue;
                        }

                        if (acQuestBuildBattle[i].enemy_list == null)
                        {
                            continue;
                        }

                        for (int j = 0; j < acQuestBuildBattle[i].enemy_list.Length; j++)
                        {
                            if (acQuestBuildBattle[i].enemy_list[j] == 0)
                            {
                                continue;
                            }

                            MasterDataParamEnemy enemy_param = ServerForgery_GetEnemyParamFromID(acQuestBuildBattle[i].enemy_list[j]);
                            e_param_list.Add(enemy_param);

                            int[] table_id = { enemy_param.act_table1,
                                               enemy_param.act_table2,
                                               enemy_param.act_table3,
                                               enemy_param.act_table4,
                                               enemy_param.act_table5,
                                               enemy_param.act_table6,
                                               enemy_param.act_table7,
                                               enemy_param.act_table8 };

                            for (int k = 0; k < table_id.Length; k++)
                            {
                                if (table_id[k] == 0)
                                {
                                    continue;
                                }

                                MasterDataEnemyActionTable table = ServerFogery_GetEnemyActionTable(table_id[k]);
                                e_act_table_list.Add(table);

                                int[] action_id = { table.action_param_id1,
                                                    table.action_param_id2,
                                                    table.action_param_id3,
                                                    table.action_param_id4,
                                                    table.action_param_id5,
                                                    table.action_param_id6,
                                                    table.action_param_id7,
                                                    table.action_param_id8 };

                                for (int l = 0; l < action_id.Length; l++)
                                {
                                    e_act_param_list.Add(GetEnemyActionParam(action_id[l]));
                                }
                            }
                        }
                    }


                    //----------------------------------------
                    // 構築した動的要素を配列化して受け渡し
                    //----------------------------------------
                    cQuestBuild.list_drop       = acQuestBuildDrop.ToArray();
                    cQuestBuild.list_battle     = acQuestBuildBattle.ToArray();
                    cQuestBuild.list_e_param    = e_param_list.ToArray();
                    cQuestBuild.list_e_actparam = e_act_param_list.ToArray();
                    cQuestBuild.list_e_acttable = e_act_table_list.ToArray();

                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild = cQuestBuild;
                }
                m_Status = eStatus.DATA_CREATE;
            }
        }
        break;

        case eStatus.DATA_CREATE:
        {
            {
                MasterDataQuest2 masterDataQuest = MasterDataUtil.GetQuest2ParamFromID(DebugOptionInGame.Instance.inGameDebugDO.m_QuestId);
                //----------------------------------------
                // ダミーパラメータを設定
                //----------------------------------------
                if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2 == null)
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2 = new SceneGoesParamToQuest2();
                }
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_QuestAreaID    = masterDataQuest.area_id;
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_QuestMissionID = masterDataQuest.fix_id;
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_QuestRandSeed  = RandManager.GetRand();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_IsUsedAutoPlay = false;

                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param = new UserDataUnitParam();

                if (DebugOptionInGame.Instance.inGameDebugDO.m_DebugParty == false &&
                    UserDataAdmin.Instance != null &&
                    UserDataAdmin.Instance.m_StructHelperList.IsNullOrEmpty() != true &&
                    UserDataAdmin.Instance.m_StructPartyAssign.IsNullOrEmpty() != true)
                {
                    PacketStructFriend cHelper      = UserDataAdmin.Instance.m_StructHelperList[m_HelperIndex];
                    int nPartyCurrent               = UserDataAdmin.Instance.m_StructPlayer.unit_party_current;
                    PacketStructUnit[] acUnitStruct =
                    {
                        UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][0]
                        , UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][1]
                        , UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][2]
                        , UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][3]
                        , cHelper.unit
                    };
                    UserDataUnitParam[] acUnitParam =
                    {
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param,
                    };
                    for (int i = 0; i < acUnitStruct.Length; i++)
                    {
                        if (acUnitStruct[i] != null)
                        {
                            acUnitParam[i].m_UnitDataID            = acUnitStruct[i].id;
                            acUnitParam[i].m_UnitParamLevel        = (int)acUnitStruct[i].level;
                            acUnitParam[i].m_UnitParamEXP          = (int)acUnitStruct[i].exp;
                            acUnitParam[i].m_UnitParamUniqueID     = acUnitStruct[i].unique_id;
                            acUnitParam[i].m_UnitParamLimitBreakLV = (int)acUnitStruct[i].limitbreak_lv;
                            acUnitParam[i].m_UnitParamLimitOverLV  = (int)acUnitStruct[i].limitover_lv;
                            acUnitParam[i].m_UnitParamPlusPow      = (int)acUnitStruct[i].add_pow;
                            acUnitParam[i].m_UnitParamPlusHP       = (int)acUnitStruct[i].add_hp;
                        }
                    }
                }
                else
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara0_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara1_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara2_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara3_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara4_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara0_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara1_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara2_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara3_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara4_level;

                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitParamEXP = 100;

                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitParamUniqueID = 1;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitParamUniqueID = 2;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitParamUniqueID = 3;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitParamUniqueID = 4;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitParamUniqueID = 5;
                }

                LocalSaveManager.Instance.SaveFuncGoesToQuest2Start(SceneGoesParam.Instance.m_SceneGoesParamToQuest2);
                LocalSaveManager.Instance.SaveFuncGoesToQuest2Restore(null);
                DebugOptionInGame.Instance.m_Quest2Build = SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild;
                SceneCommon.Instance.ChangeScene(SceneType.SceneQuest2);
            }
            m_Status = eStatus.NONE;
        }
        break;

        case eStatus.DATA_RESTORE:
        {
            {
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2        = LocalSaveManager.Instance.LoadFuncGoesToQuest2Start();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2Restore = LocalSaveManager.Instance.LoadFuncGoesToQuest2Restore();
                if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build == null)
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build = new SceneGoesParamToQuest2Build();
                }
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild = DebugOptionInGame.Instance.m_Quest2Build;
                SceneCommon.Instance.ChangeScene(SceneType.SceneQuest2);
            }
            m_Status = eStatus.NONE;
        }
        break;

        default:
            break;
        }
    }