private ServerNpcModel buildRandomNPC(int npcLevel, int npcTeamID, RarityType minRarityType, RarityType maxRarityType) { RarityType npcRarity = RarityConstants.GetRandomRarityRange(minRarityType, maxRarityType); NpcRole npcRole = (NpcRole)RandomGen.GetIntRange(0, NumNpcRoles - 1); NpcRace npcRace = (NpcRace)RandomGen.GetIntRange(0, NumNpcRaces - 1); NpcSize npcSize = (NpcSize)RandomGen.GetIntRange(0, NumNpcSizes - 1); // TODO: determine better naming scheme. For now just join Size+Race+Role; string npcName = npcSize.ToString() + " " + npcRace.ToString() + " " + npcRole.ToString(); // Build combatant model AbilityItemModel[] randomAbilities = getRandomNPCAbilities((int)npcRarity + 1, npcLevel); CombatantModel combatantModel = BuildCombatantSCMD.Execute(npcLevel, npcTeamID, randomAbilities, npcRarity); // TODO: determine behaviour based on role. For now use default CombatBehaviourBase combatBehaviour = new AbilityCycleBehaviour(); ServerNpcModel serverNpcModel = new ServerNpcModel(combatBehaviour, "", npcName, npcRole, npcRace, npcSize, npcRarity, combatantModel); DetermineNPCDropTableSCMD.Execute(serverNpcModel); return(serverNpcModel); }
private void parseEquipmentAndCombatantModel(ServerPlayerModel serverPlayerModel) { if (catalogModel == null) { catalogModel = DIContainer.GetInstanceByContextID <CatalogModel>(InstanceServerApplication.CONTEXT_ID); } // Parse equipment parseItemModel <EquipmentItemModel>(ref serverPlayerModel.EquippedWeaponItemModel, ref serverPlayerModel.EquippedWeapon); parseItemModel <EquipmentItemModel>(ref serverPlayerModel.EquippedOffHandItemModel, ref serverPlayerModel.EquippedOffHand); parseItemModel <EquipmentItemModel>(ref serverPlayerModel.EquippedArmorItemModel, ref serverPlayerModel.EquippedArmor); List <EquipmentItemModel> allEquipment = new List <EquipmentItemModel>(); if (serverPlayerModel.EquippedWeaponItemModel != null) { allEquipment.Add(serverPlayerModel.EquippedWeaponItemModel); } if (serverPlayerModel.EquippedOffHandItemModel != null) { allEquipment.Add(serverPlayerModel.EquippedOffHandItemModel); } if (serverPlayerModel.EquippedArmorItemModel != null) { allEquipment.Add(serverPlayerModel.EquippedArmorItemModel); } // Player must have at least 1 Ability AbilityItemModel[] equippedAbilityItemModels = new AbilityItemModel[serverPlayerModel.EquippedAbilities.Length]; for (int i = 0; i < equippedAbilityItemModels.Length; i++) { parseItemModel <AbilityItemModel>(ref equippedAbilityItemModels[i], ref serverPlayerModel.EquippedAbilities[i]); } serverPlayerModel.CombatantModel = BuildCombatantSCMD.Execute(serverPlayerModel.Level_ZeroBased, PlayerModel.DEFAULT_TEAM_ID, equippedAbilityItemModels, RarityType.Common, allEquipment.Count == 0 ? null : allEquipment.ToArray()); }