コード例 #1
0
        public void EnterMission(int missionID, int difficulty)
        {
            var missionData = LocalServerResManager.MissionDataMap.FirstOrDefault(t => t.Value.mission == missionID && t.Value.difficulty == difficulty);

            if (missionData.Value == null)
            {
                return;
            }

            ClearSceneData();
            LocalServerResManager.ResetSpaceData(missionData.Value);
            ConstructEventData(missionData.Value.events);
            ConstructMissionTargetData(missionData.Value.target);
            ConstructEntityData(difficulty);
            ConstructContainerData(missionData.Value.drop);
            EnterResetAvatarData(missionData.Value.reviveTimes);
            sceneId = LocalServerResManager.GetSceneId(missionID, difficulty);
        }
コード例 #2
0
        protected void ConstructMonsterData(int difficulty)
        {
            foreach (var item in LocalServerResManager.SpaceDataMap)
            {
                var spaceData = item.Value;
                if (spaceData.type != SpaceType.SpawnPoint.ToString())
                {
                    continue;
                }

                if (spaceData.levelID.Count < difficulty)
                {
                    continue;
                }

                int levelID = spaceData.levelID[difficulty - 1];
                if (!LocalServerResManager.SpawnPointLevelDataMap.ContainsKey(levelID))
                {
                    continue;
                }

                List <int> monsterIDs  = LocalServerResManager.SpawnPointLevelDataMap[levelID].monsterId;
                List <int> monsterNums = LocalServerResManager.SpawnPointLevelDataMap[levelID].monsterNumber;

                if (monsterIDs.Count != monsterNums.Count)
                {
                    continue;
                }

                if (item.Value.monsterSpawntPoint.Count % 2 != 0)
                {
                    continue;
                }

                List <KeyValuePair <int, int> > place = new List <KeyValuePair <int, int> >();
                for (int i = 0; i < item.Value.monsterSpawntPoint.Count; i += 2)
                {
                    KeyValuePair <int, int> coordinate = new KeyValuePair <int, int>(item.Value.monsterSpawntPoint[i], item.Value.monsterSpawntPoint[i + 1]);
                    place.Add(coordinate);
                }

                if (!localServerSpawnPoint.ContainsKey(item.Key))
                {
                    localServerSpawnPoint.Add(item.Key, new SpawnPoint(item.Key, item.Value.triggerType));
                }

                if (!localServerMonster.ContainsKey(item.Key))
                {
                    localServerMonster.Add(item.Key, new Dictionary <uint, LocalServerEntity>());
                }

                if (!localServerTokenTemplete.ContainsKey(item.Key))
                {
                    localServerTokenTemplete.Add(item.Key, new List <LocalServerEntity>());
                }

                int monsterCount = 0;
                for (int i = 0; i < monsterIDs.Count; i++)
                {
                    for (int j = 0; j < monsterNums[i]; j++)
                    {
                        if (monsterCount < place.Count)
                        {
                            LocalServerDummy dummy = new LocalServerDummy();
                            dummy.ID           = getNextEntityId();
                            dummy.spawnPointID = item.Key;
                            dummy.monsterID    = monsterIDs[i];
                            dummy.state        = MonsterState.sleep;
                            dummy.x            = place[monsterCount].Key;
                            dummy.y            = place[monsterCount].Value;
                            dummy.exp          = LocalServerResManager.GetMonsterData(dummy.monsterID).exp;

                            monsterCount++;

                            if (!localServerEntity.ContainsKey(dummy.ID) &&
                                !localServerMonster[item.Key].ContainsKey(dummy.ID))
                            {
                                localServerEntity.Add(dummy.ID, dummy);
                                localServerMonster[item.Key].Add(dummy.ID, dummy);
                                localServerTokenTemplete[item.Key].Add(dummy);
                            }
                            //else
                            //{
                            //    dummy.state = MonsterState.invalid;
                            //    dummy.x = 0;
                            //    dummy.x = 0;
                            //}
                        }
                        //else
                        //{
                        //}
                    }
                }
            }
        }
コード例 #3
0
        public void MissionReq(byte handleCode, ushort arg1, ushort arg2, string arg3)
        {
            switch (handleCode)
            {
            case (byte)MissionHandleCode.ENTER_MISSION:
                EnterMission((int)arg1, (int)arg2);
                break;

            case (byte)MissionHandleCode.START_MISSION:
                List <int> pos = LocalServerResManager.GetEnterXY(sceneId);
                if (pos.Count == 0)
                {
                    LoggerHelper.Error(string.Format("sceneId {0} is enter xy is error", sceneId));
                    return;
                }
                var info = new Mogo.RPC.CellAttachedInfo();
                info.x = (short)pos[0];
                info.y = (short)pos[1];
                MogoWorld.thePlayer.SetEntityCellInfo(info);
                MogoWorld.thePlayer.UpdatePosition();

                CheckSpawnPointDefaultSpawn();
                break;

            case (byte)MissionHandleCode.EXIT_MISSION:
                ServerProxy.SomeToLocal = false;
                ExitMission();
                MogoWorld.thePlayer.RpcCall("MissionReq", (byte)MissionHandleCode.EXIT_MISSION, (ushort)1, (ushort)1, String.Empty);
                break;

            case (byte)MissionHandleCode.QUIT_MISSION:
                ServerProxy.SomeToLocal = false;
                ExitMission();
                MogoWorld.thePlayer.RpcCall("MissionReq", (byte)MissionHandleCode.QUIT_MISSION, (ushort)1, (ushort)1, String.Empty);
                break;

            case (byte)MissionHandleCode.GO_TO_INIT_MAP:
                ServerProxy.SomeToLocal = false;
                ExitMission();
                MogoWorld.thePlayer.RpcCall("MissionReq", (byte)MissionHandleCode.GO_TO_INIT_MAP, (ushort)1, (ushort)1, String.Empty);
                break;

            case (byte)MissionHandleCode.SPAWNPOINT_START:
                TriggerSpawnPoint((int)arg1);
                break;

            case (byte)MissionHandleCode.CREATE_CLIENT_DROP:
                CreateClientDrop(arg1, arg3);
                break;

            case (byte)MissionHandleCode.GET_REVIVE_TIMES:
                LoggerHelper.Debug("GET_REVIVE_TIMES");
                NotifyReviveTime();
                break;

            case (byte)MissionHandleCode.REVIVE:
                LoggerHelper.Debug("REVIVE");
                AvatarRevive();
                break;

            case (byte)MissionHandleCode.UPLOAD_COMBO:
                SetCombo(arg1);
                NotifyClientMissionWon();
                break;

            case (byte)MissionHandleCode.GET_MISSION_REWARDS:
                ServerProxy.SomeToLocal = false;
                SendClientMissionMessage();
                GetMissionReward();
                break;
            }
        }