コード例 #1
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var allowedByLevelAndCategoryContracts = resource.contracts.GetContracts(ContractCategory.exploreLocation, level);

            if (allowedByLevelAndCategoryContracts.Count == 0)
            {
                s_Log.InfoFormat("not found contracts for level and category");
                return(null);
            }

            List <ExploreLocationContractData> contractsWithAllowedLocations = new List <ExploreLocationContractData>();

            foreach (var c in allowedByLevelAndCategoryContracts)
            {
                var exploreLocationContract = c as ExploreLocationContractData;
                if (exploreLocationContract != null)
                {
                    if (exploreLocationContract.Has(race, level))
                    {
                        contractsWithAllowedLocations.Add(exploreLocationContract);
                    }
                }
            }

            if (contractsWithAllowedLocations.Count == 0)
            {
                s_Log.InfoFormat("not found contracts with locations for level and category");
                return(null);
            }

            ExploreLocationContractData resultContractData = contractsWithAllowedLocations.AnyElement();
            var locationData = resultContractData.GetRandom(race, level);

            if (locationData == null)
            {
                s_Log.InfoFormat("location data is null");
                return(null);
            }

            ExploreLocationContract contract = new ExploreLocationContract(
                resultContractData.id,
                0,
                sourceWorld,
                manager,
                locationData.name,
                locationData.RandomZone()
                );

            s_Log.InfoFormat("contract generated succsessfully");

            return(contract);
        }
コード例 #2
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var contracts = resource.contracts.GetContracts(ContractCategory.worldCapture, level);

            if (contracts.Count == 0)
            {
                return(null);
            }

            WorldCaptureContractData data = contracts.AnyElement() as WorldCaptureContractData;

            if (data == null)
            {
                return(null);
            }

            var playerRaceable = manager.GetComponent <RaceableObject>();

            if (playerRaceable == null)
            {
                return(null);
            }

            Race playerRace = (Race)playerRaceable.race;

            Race targetRace = data.GenerateTargetRace(playerRace);

            WorldCaptureContract result = new WorldCaptureContract(data.id, 0, sourceWorld, manager, targetRace);

            return(result);
        }
コード例 #3
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var allowedByLevelAndCategoryContracts = resource.contracts.GetContracts(ContractCategory.killNPCGroup, level);

            if (allowedByLevelAndCategoryContracts.Count == 0)
            {
                return(null);
            }

            List <KillNPCGroupContractData> contractsWithAllowedGroups = new List <KillNPCGroupContractData>();

            foreach (var c in allowedByLevelAndCategoryContracts)
            {
                var killGroupContract = c as KillNPCGroupContractData;
                if (killGroupContract != null)
                {
                    if (killGroupContract.HasGroups(race, level))
                    {
                        contractsWithAllowedGroups.Add(killGroupContract);
                    }
                }
            }

            if (contractsWithAllowedGroups.Count == 0)
            {
                return(null);
            }

            KillNPCGroupContractData resultContractData = contractsWithAllowedGroups.AnyElement();

            var groupData = resultContractData.GetRandomGroup(race, level);

            if (groupData == null)
            {
                return(null);
            }

            KillNPCGroupContract contract = new KillNPCGroupContract(resultContractData.id,
                                                                     0,
                                                                     sourceWorld,
                                                                     manager,
                                                                     groupData.count,
                                                                     groupData.name,
                                                                     groupData.RandomZone());

            return(contract);
        }
コード例 #4
0
 public abstract BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource);
コード例 #5
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var levelTypeList = resource.contracts.GetContracts(ContractCategory.foundItem, level);

            if (levelTypeList.Count == 0)
            {
                s_Log.InfoFormat("itemTypeList is count 0".Color(LogColor.green));
                return(null);
            }

            var raceLevelList = new List <FoundItemContractData>();

            foreach (var c in levelTypeList)
            {
                var contract = c as FoundItemContractData;
                if (contract != null)
                {
                    if (contract.Has(race, level))
                    {
                        raceLevelList.Add(contract);
                    }
                }
            }

            if (raceLevelList.Count == 0)
            {
                s_Log.InfoFormat("raceLevelList count 0".Color(LogColor.green));
                return(null);
            }

            var randomContract = raceLevelList.AnyElement();
            var randomItem     = randomContract.GetRandom(race, level);

            if (randomItem == null)
            {
                s_Log.InfoFormat("random item is null".Color(LogColor.green));
                return(null);
            }

            string npcZone = randomItem.RandomNpcZone();

            if (string.IsNullOrEmpty(npcZone))
            {
                s_Log.InfoFormat("npcZone is empty".Color(LogColor.green));
                return(null);
            }

            FoundItemContract retContract = new FoundItemContract(
                randomContract.id,
                0,
                npcZone,
                manager,
                randomItem.name,
                randomItem.name,
                randomItem.RandomZone()
                );

            return(retContract);
        }
コード例 #6
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var contracts = resource.contracts.GetContracts(ContractCategory.destroyConstruction, level);

            if (contracts.Count == 0)
            {
                s_Log.InfoFormat("contracts of type destroyConstruction is zero");
                return(null);
            }
            DestroyConstructionContractData data = contracts.AnyElement() as DestroyConstructionContractData;

            if (data == null)
            {
                s_Log.InfoFormat("contract data is zero");
                return(null);
            }

            var sourceRaceableComponent = manager.GetComponent <RaceableObject>();

            if (sourceRaceableComponent == null)
            {
                s_Log.InfoFormat("not found raceable component on player");
                return(null);
            }


            Race           sourceRace       = (Race)sourceRaceableComponent.race;
            BotItemSubType constructionType = data.GenerateConstructionType();
            Race           constructionRace = data.GenerateTargetRace(sourceRace);

            DestroyConstructionContract result = new DestroyConstructionContract(data.id, 0, sourceWorld, manager, constructionType, constructionRace);

            s_Log.InfoFormat("successfully generated contract destroy = {0} of race = {1}", constructionType, constructionRace);
            return(result);
        }
コード例 #7
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var allowedByLevelAndCategoryContracts = resource.contracts.GetContracts(ContractCategory.itemDelivery, level);

            if (allowedByLevelAndCategoryContracts.Count == 0)
            {
                return(null);
            }
            List <ItemDeliveryContractData> contractsWithAllowedItems = new List <ItemDeliveryContractData>();

            foreach (var c in allowedByLevelAndCategoryContracts)
            {
                var itemDeliveryContract = c as ItemDeliveryContractData;
                if (itemDeliveryContract.Has(race, level))
                {
                    contractsWithAllowedItems.Add(itemDeliveryContract);
                }
            }
            if (contractsWithAllowedItems.Count == 0)
            {
                return(null);
            }
            ItemDeliveryContractData resultContractData = contractsWithAllowedItems.AnyElement();
            var itemData = resultContractData.GetRandom(race, level);

            if (itemData == null)
            {
                return(null);
            }
            string currentWorld = manager.nebulaObject.mmoWorld().GetID();
            var    zones        = itemData.zones.Where(z => z != currentWorld).ToList();

            if (zones.Count == 0)
            {
                return(null);
            }

            ItemDeliveryContract contract = new ItemDeliveryContract(resultContractData.id,
                                                                     0,
                                                                     sourceWorld,
                                                                     manager,
                                                                     itemData.name,
                                                                     zones.AnyElement());

            return(contract);
        }
コード例 #8
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var contracts = resource.contracts.GetContracts(ContractCategory.killPlayer, level);

            if (contracts.Count == 0)
            {
                return(null);
            }

            KillPlayerContractData data = contracts.AnyElement() as KillPlayerContractData;

            if (data == null)
            {
                return(null);
            }

            KillPlayerContract result = new KillPlayerContract(data.id, 0, sourceWorld, manager, data.playerCount);

            return(result);
        }
コード例 #9
0
        public override BaseContract Generate(Race race, int level, string sourceWorld, ContractManager manager, IContractResource resource)
        {
            var contracts = resource.contracts.GetContracts(ContractCategory.upgradeCompanion, level);

            if (contracts.Count == 0)
            {
                s_Log.InfoFormat("contracts of type upgradeCompanion is zero");
                return(null);
            }
            UpgradePetContractData data = contracts.AnyElement() as UpgradePetContractData;

            if (data == null)
            {
                return(null);
            }

            UpgradePetContract result = new UpgradePetContract(data.id, 0, sourceWorld, manager);

            return(result);
        }