Exemple #1
0
 public NpcModel(string id, string name, NpcRole npcRole, NpcRace npcRace, NpcSize npcSize, RarityType rarityType,
                 CombatantModel combatantModel, string[] alwaysDroppedItemIDs = null)
 {
     this.ID                   = id;
     this.Name                 = name;
     this.NpcRole              = npcRole;
     this.NpcRace              = npcRace;
     this.NpcSize              = npcSize;
     this.RarityType           = rarityType;
     this.CombatantModel       = combatantModel;
     this.AlwaysDroppedItemIDs = alwaysDroppedItemIDs;
 }
Exemple #2
0
        public void FromObjectArray(object[] properties)
        {
            int i = 0;

            ID             = properties[i++] as string;
            Name           = properties[i++] as string;
            NpcRole        = (NpcRole)properties[i++];
            NpcRace        = (NpcRace)properties[i++];
            NpcSize        = (NpcSize)properties[i++];
            RarityType     = (RarityType)properties[i++];
            CombatantModel = new CombatantModel();
            CombatantModel.FromObjectArray(properties[i++] as object[]);

            object[] alwaysDroppedItemIdObjects = properties[i++] as object[];
            AlwaysDroppedItemIDs = new string[alwaysDroppedItemIdObjects.Length];
            for (int j = 0; j < AlwaysDroppedItemIDs.Length; j++)
            {
                AlwaysDroppedItemIDs[j] = alwaysDroppedItemIdObjects[j] as string;
            }
        }
Exemple #3
0
        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);
        }
 public ServerNpcModel(CombatBehaviourBase combatantBehaviour, string id, string name, NpcRole npcRole, NpcRace npcRace,
                       NpcSize npcSize, RarityType rarityType, CombatantModel combatantModel, string[] alwaysDroppedItemIDs = null) : base(id,
                                                                                                                                           name, npcRole, npcRace, npcSize, rarityType, combatantModel, alwaysDroppedItemIDs)
 {
     this.CombatBehaviour = combatantBehaviour;
 }