public Player CreatePlayer(int id, CreatePlayerInfo create_info, bool self, Vector3 pos, float dir, PlayerTransferInfo transfer_info = null, PlayerLoader.OnCompleteLoad callback = null) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) if (create_info.charaInfo == null) { Log.Error("StageObjectManager.CreatePlayer() charaInfo is NULL"); return(null); } GameObject val = new GameObject(); val.set_name("Player:" + id); val.get_transform().set_parent(base._transform); int num = 0; if (create_info.extentionInfo != null) { num = create_info.extentionInfo.npcDataID; } bool flag = num > 0; Player player; if (self) { player = val.AddComponent <Self>(); if (MonoBehaviourSingleton <InGameCameraManager> .IsValid()) { MonoBehaviourSingleton <InGameCameraManager> .I.target = player._transform; } } else if (flag) { player = val.AddComponent <NonPlayer>(); NonPlayer nonPlayer = player as NonPlayer; nonPlayer.npcId = num; if (Singleton <NPCTable> .IsValid()) { nonPlayer.npcTableData = Singleton <NPCTable> .I.GetNPCData(num); } nonPlayer.lv = create_info.extentionInfo.npcLv; nonPlayer.lv_index = create_info.extentionInfo.npcLvIndex; } else { player = val.AddComponent <Player>(); } player.id = id; player._transform.set_position(pos); player._transform.set_eulerAngles(new Vector3(0f, dir, 0f)); player.SetState(create_info, transfer_info); if (MonoBehaviourSingleton <InGameRecorder> .IsValid()) { int userId = create_info.charaInfo.userId; InGameRecorder.PlayerRecord playerRecord = player.record = MonoBehaviourSingleton <InGameRecorder> .I.GetPlayer(id, userId); playerRecord.isSelf = self; playerRecord.isNPC = flag; playerRecord.charaInfo = create_info.charaInfo; playerRecord.beforeLevel = create_info.charaInfo.level; } if (self) { player.AddController <SelfController>(); } else if (flag) { player.AddController <NpcController>(); } if (MonoBehaviourSingleton <InGameSettingsManager> .IsValid()) { EffectPlayProcessor component = MonoBehaviourSingleton <InGameSettingsManager> .I.get_gameObject().GetComponent <EffectPlayProcessor>(); if (component != null && component.effectSettings != null) { player.effectPlayProcessor = val.AddComponent <EffectPlayProcessor>(); player.effectPlayProcessor.effectSettings = component.effectSettings; } } PlayerLoadInfo playerLoadInfo = new PlayerLoadInfo(); if (player.weaponData != null) { playerLoadInfo.SetEquipWeapon(create_info.charaInfo.sex, (uint)player.weaponData.eId); } playerLoadInfo.Apply(create_info.charaInfo, false, true, true, true); player.Load(playerLoadInfo, callback); player.OnSetPlayerStatus(create_info.charaInfo.level, create_info.charaInfo.atk, create_info.charaInfo.def, create_info.charaInfo.hp, false, transfer_info); player.StartFieldBuff(MonoBehaviourSingleton <FieldManager> .IsValid() ? MonoBehaviourSingleton <FieldManager> .I.currentFieldBuffId : 0); return(player); }
public Player CreateNonPlayer(int id, CreatePlayerInfo.ExtentionInfo extention_info, Vector3 pos, float dir, PlayerTransferInfo transfer_info = null, PlayerLoader.OnCompleteLoad callback = null) { //IL_0237: Unknown result type (might be due to invalid IL or missing references) CreatePlayerInfo createPlayerInfo = new CreatePlayerInfo(); createPlayerInfo.charaInfo = new CharaInfo(); bool flag = QuestManager.IsValidInGame() && MonoBehaviourSingleton <QuestManager> .I.GetVorgonQuestType() != QuestManager.VorgonQuetType.NONE; bool flag2 = false; if (extention_info != null) { createPlayerInfo.extentionInfo = extention_info; } else { createPlayerInfo.extentionInfo = new CreatePlayerInfo.ExtentionInfo(); flag2 = true; } NPCTable.NPCData nPCData = null; if (flag2) { List <int> list = new List <int>(); int i = 0; for (int count = nonplayerList.Count; i < count; i++) { NonPlayer nonPlayer = nonplayerList[i] as NonPlayer; if (nonPlayer != null) { list.Add(nonPlayer.npcId); } } nPCData = Singleton <NPCTable> .I.GetNPCDataRandom(NPCTable.NPC_TYPE.FIGURE, list); if (nPCData != null) { createPlayerInfo.extentionInfo.npcDataID = nPCData.id; } } else { nPCData = Singleton <NPCTable> .I.GetNPCData(createPlayerInfo.extentionInfo.npcDataID); } if (flag) { int npc_id = VorgonPreEventController.NPC_ID_LIST[id % 3]; nPCData = Singleton <NPCTable> .I.GetNPCData(npc_id); } if (nPCData == null) { return(null); } nPCData.CopyCharaInfo(createPlayerInfo.charaInfo); NpcLevelTable.NpcLevelData npcLevelData = null; if (flag2) { int lv = 1; if (QuestManager.IsValidInGame() && MonoBehaviourSingleton <QuestManager> .I.GetCurrentQuestEnemyID() > 0) { lv = MonoBehaviourSingleton <QuestManager> .I.GetCurrentQuestEnemyLv(); } if (flag) { lv = 80; } npcLevelData = Singleton <NpcLevelTable> .I.GetNpcLevelRandom((uint)lv); if (npcLevelData != null) { createPlayerInfo.extentionInfo.npcLv = (int)npcLevelData.lv; createPlayerInfo.extentionInfo.npcLvIndex = npcLevelData.lvIndex; } } else { npcLevelData = Singleton <NpcLevelTable> .I.GetNpcLevel((uint)createPlayerInfo.extentionInfo.npcLv, createPlayerInfo.extentionInfo.npcLvIndex); } if (npcLevelData == null) { return(null); } npcLevelData.CopyHomeCharaInfo(createPlayerInfo.charaInfo, (!flag2) ? null : createPlayerInfo.extentionInfo); if (flag) { for (int j = 0; j < createPlayerInfo.charaInfo.equipSet.Count; j++) { createPlayerInfo.charaInfo.equipSet[j].eId = VorgonPreEventController.NPC_WEAPON_ID_LIST[id % 3]; } } return(CreatePlayer(id, createPlayerInfo, false, pos, dir, transfer_info, callback)); }