コード例 #1
0
 public ResourceProductionComponent(ConstructionItem ci, Level level)
     : base(ci)
 {
     this.m_vTimeSinceLastClick = level.GetTime();
     this.m_vProductionResourceData = ObjectManager.DataTables.GetResourceByName(((BuildingData)ci.GetData()).ProducesResource);
     this.m_vResourcesPerHour = ((BuildingData)ci.GetData()).ResourcePerHour;
     this.m_vMaxResources = ((BuildingData)ci.GetData()).ResourceMax;
 }
コード例 #2
0
 public bool HasEnoughResources(ResourceData rd, int buildCost)
 {
     return GetResourceCount(rd) >= buildCost;
 }
コード例 #3
0
ファイル: Avatar.cs プロジェクト: BananaEmulator/BananaEmu
 public void SetResourceCount(ResourceData rd, int value)
 {
     int index = GetDataIndex(m_vResources, rd);
     if (index == -1)
     {
         var ds = new DataSlot(rd, value);
         m_vResources.Add(ds);
     }
     else
     {
         m_vResources[index].Value = value;
     }
     //LogicLevel::getComponentManager(v18);
     //LogicComponentManager::divideAvatarResourcesToStorages(v19)
 }
コード例 #4
0
ファイル: Avatar.cs プロジェクト: BananaEmulator/BananaEmu
 public void SetResourceCap(ResourceData rd, int value)
 {
     int index = GetDataIndex(m_vResourceCaps, rd);
     if(index == -1)
     {
         var ds = new DataSlot(rd, value);
         m_vResourceCaps.Add(ds);
     }
     else
     {
         m_vResourceCaps[index].Value = value;
     }
 }
コード例 #5
0
ファイル: Avatar.cs プロジェクト: BananaEmulator/BananaEmu
 public int GetUnusedResourceCap(ResourceData rd)
 {
     int resourceCount = GetResourceCount((ResourceData)rd);
     int resourceCap = GetResourceCap((ResourceData)rd);
     return Math.Max(resourceCap - resourceCount, 0);
 }
コード例 #6
0
ファイル: Avatar.cs プロジェクト: BananaEmulator/BananaEmu
 public int GetResourceCount(ResourceData rd)
 {
     int index = GetDataIndex(m_vResources, rd);
     int count = 0;
     if (index != -1)
         count = m_vResources[index].Value;
     return count;
 }
コード例 #7
0
 public Data CreateItem(CSVRow row)
 {
     Data d = new Data(row, this);
     switch (m_vIndex)
     {
         case 0:
             d = new BuildingData(row, this);
             break;
         case 2:
             d = new ResourceData(row, this);
             break;
         case 3:
             d = new CharacterData(row, this);
             break;
         case 7:
             d = new ObstacleData(row, this);
             break;
         case 10:
             d = new ExperienceLevelData(row, this);
             break;
         case 11:
             d = new TrapData(row, this);
             break;
         case 12:
             d = new LeagueData(row, this);
             break;
         case 13:
             d = new GlobalData(row, this);
             break;
         case 14:
             d = new TownhallLevelData(row, this);
             break;
         case 16:
             d = new NpcData(row, this);
             break;
         case 17:
             d = new DecoData(row, this);
             break;
         case 19:
             d = new ShieldData(row, this);
             break;
         case 22:
             d = new AchievementData(row, this);
             break;
         case 23:
             d = new Data(row, this);
             break;
         case 24:
             d = new Data(row, this);
             break;
         case 25:
             d = new SpellData(row, this);
             break;
         case 27:
             d = new HeroData(row, this);
             break;
         /*case 28:
             d = new WarData(dic);
             break;*/
         default:
             break;
     }
     return d;
 }
コード例 #8
0
ファイル: DataTable.cs プロジェクト: megamike72/UCS-0.6.5
        public Data CreateItem(CSVRow row)
        {
            var d = new Data(row, this);

            switch (m_vIndex)
            {
            case 0:
                d = new BuildingData(row, this);
                break;

            case 2:
                d = new ResourceData(row, this);
                break;

            case 3:
                d = new CharacterData(row, this);
                break;

            case 7:
                d = new ObstacleData(row, this);
                break;

            case 10:
                d = new ExperienceLevelData(row, this);
                break;

            case 11:
                d = new TrapData(row, this);
                break;

            case 12:
                d = new LeagueData(row, this);
                break;

            case 13:
                d = new GlobalData(row, this);
                break;

            case 14:
                d = new TownhallLevelData(row, this);
                break;

            case 16:
                d = new NpcData(row, this);
                break;

            case 17:
                d = new DecoData(row, this);
                break;

            case 19:
                d = new ShieldData(row, this);
                break;

            case 22:
                d = new AchievementData(row, this);
                break;

            case 23:
                d = new Data(row, this);
                break;

            case 24:
                d = new Data(row, this);
                break;

            case 25:
                d = new SpellData(row, this);
                break;

            case 27:
                d = new HeroData(row, this);
                break;

            case 28:
                d = new WarData(row, this);
                break;

            case 30:
                d = new AllianceBadgeLayersData(row, this);
                break;

            case 31:
                d = new AllianceBadgesData(row, this);
                break;

            case 32:
                d = new AllianceLevelsData(row, this);
                break;

            case 33:
                d = new AlliancePortalData(row, this);
                break;

            case 34:
                d = new BuildingClassesData(row, this);
                break;

            case 35:
                d = new EffectsData(row, this);
                break;

            case 36:
                d = new LocalesData(row, this);
                break;

            case 37:
                d = new MissionsData(row, this);
                break;

            case 38:
                d = new ProjectilesData(row, this);
                break;

            case 39:
                d = new RegionsData(row, this);
                break;

            case 40:
                d = new VariablesData(row, this);
                break;

            default:
                break;
            }
            return(d);
        }
コード例 #9
0
        public int GetResourceDiamondCost(int resourceCount, ResourceData resourceData)
        {
            int result = 0;

            if (resourceData == ObjectManager.DataTables.GetResourceByName("DarkElixir"))
            {
                result = this.GetDarkElixirDiamondCost(resourceCount);
            }
            else
            {
                if (resourceCount >= 1)
                {
                    if (resourceCount >= 100)
                    {
                        if (resourceCount >= 1000)
                        {
                            if (resourceCount >= 10000)
                            {
                                if (resourceCount >= 100000)
                                {
                                    if (resourceCount >= 1000000)
                                    {
                                        int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_10000000").NumberValue;
                                        int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000000").NumberValue;
                                        result = GamePlayUtil.CalculateResourceCost(10000000, 1000000, supCost, infCost, resourceCount);
                                    }
                                    else
                                    {
                                        int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000000").NumberValue;
                                        int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100000").NumberValue;
                                        result = GamePlayUtil.CalculateResourceCost(1000000, 100000, supCost, infCost, resourceCount);
                                    }
                                }
                                else
                                {
                                    int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100000").NumberValue;
                                    int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_10000").NumberValue;
                                    result = GamePlayUtil.CalculateResourceCost(100000, 10000, supCost, infCost, resourceCount);
                                }
                            }
                            else
                            {
                                int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_10000").NumberValue;
                                int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000").NumberValue;
                                result = GamePlayUtil.CalculateResourceCost(10000, 1000, supCost, infCost, resourceCount);
                            }
                        }
                        else
                        {
                            int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000").NumberValue;
                            int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100").NumberValue;
                            result = GamePlayUtil.CalculateResourceCost(1000, 100, supCost, infCost, resourceCount);
                        }
                    }
                    else
                    {
                        result = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100").NumberValue;
                    }
                }
            }

            return(result);
        }
コード例 #10
0
        /// <summary>
        /// Create the item.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns>The Data.</returns>
        public Data CreateItem(CSVRow row)
        {
            Data _Data;

            // Data _Data = new Data(row, this);
            switch (this.m_vIndex)
            {
            case 1:
            {
                _Data = new Achievements(row, this);
                break;
            }

            case 2:
            {
                _Data = new Alliance_Badges(row, this);
                break;
            }

            case 3:
            {
                _Data = new Alliance_Roles(row, this);
                break;
            }

            case 4:
            {
                _Data = new Area_Effect_Objects(row, this);
                break;
            }

            case 5:
            {
                _Data = new Arenas(row, this);
                break;
            }

            case 6:
            {
                _Data = new Buildings(row, this);
                break;
            }

            case 7:
            {
                _Data = new Character_Buffs(row, this);
                break;
            }

            case 8:
            {
                _Data = new CharacterData(row, this);
                break;
            }

            case 9:
            {
                _Data = new Chest_Order(row, this);
                break;
            }

            case 10:
            {
                _Data = new Content_Tests(row, this);
                break;
            }

            case 11:
            {
                _Data = new Damage_Types(row, this);
                break;
            }

            case 12:
            {
                _Data = new Decos(row, this);
                break;
            }

            case 13:
            {
                _Data = new Exp_Levels(row, this);
                break;
            }

            case 14:
            {
                _Data = new Gamble_Chests(row, this);
                break;
            }

            case 15:
            {
                _Data = new GlobalData(row, this);
                break;
            }

            case 16:
            {
                _Data = new Locales(row, this);
                break;
            }

            case 17:
            {
                _Data = new Locations(row, this);
                break;
            }

            case 18:
            {
                _Data = new Npcs(row, this);
                break;
            }

            case 19:
            {
                _Data = new Predefined_Decks(row, this);
                break;
            }

            case 20:
            {
                _Data = new Projectiles(row, this);
                break;
            }

            case 21:
            {
                _Data = new Rarities(row, this);
                break;
            }

            case 22:
            {
                _Data = new Regions(row, this);
                break;
            }

            case 23:
            {
                _Data = new Resource_Packs(row, this);
                break;
            }

            case 24:
            {
                _Data = new ResourceData(row, this);
                break;
            }

            case 25:
            {
                _Data = new Shop(row, this);
                break;
            }

            case 26:
            {
                _Data = new Spawn_Points(row, this);
                break;
            }

            case 27:
            {
                _Data = new Spell_Sets(row, this);
                break;
            }

            case 28:
            {
                _Data = new Spells_Buildings(row, this);
                break;
            }

            case 29:
            {
                _Data = new Spells_Characters(row, this);
                break;
            }

            case 30:
            {
                _Data = new Spells_Other(row, this);
                break;
            }

            case 31:
            {
                _Data = new Survival_Modes(row, this);
                break;
            }

            case 32:
            {
                _Data = new Taunts(row, this);
                break;
            }

            case 33:
            {
                _Data = new Tournament_Tiers(row, this);
                break;
            }

            case 34:
            {
                _Data = new Treasure_Chests(row, this);
                break;
            }

            case 35:
            {
                _Data = new Tutorials_Home(row, this);
                break;
            }

            case 36:
            {
                _Data = new Tutorials_Npc(row, this);
                break;
            }

            default:
            {
                _Data = new Data(row, this);
                break;
            }

                // default:
                // break;
            }

            return(_Data);
        }
コード例 #11
0
 public int GetResourceDiamondCost(int resourceCount, ResourceData resourceData)
 {
     int result = 0;
     if (resourceData == ObjectManager.DataTables.GetResourceByName("DarkElixir"))
     {
         result = GetDarkElixirDiamondCost(resourceCount);
     }
     else
     {
         if (resourceCount >= 1)
         {
             if (resourceCount >= 100)
             {
                 if (resourceCount >= 1000)
                 {
                     if (resourceCount >= 10000)
                     {
                         if (resourceCount >= 100000)
                         {
                             if (resourceCount >= 1000000)
                             {
                                 int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_10000000").NumberValue;
                                 int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000000").NumberValue;
                                 result = GamePlayUtil.CalculateResourceCost(10000000, 1000000, supCost, infCost, resourceCount);
                             }
                             else
                             {
                                 int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000000").NumberValue;
                                 int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100000").NumberValue;
                                 result = GamePlayUtil.CalculateResourceCost(1000000, 100000, supCost, infCost, resourceCount);
                             }
                         }
                         else
                         {
                             int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100000").NumberValue;
                             int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_10000").NumberValue;
                             result = GamePlayUtil.CalculateResourceCost(100000, 10000, supCost, infCost, resourceCount);
                         }
                     }
                     else
                     {
                         int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_10000").NumberValue;
                         int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000").NumberValue;
                         result = GamePlayUtil.CalculateResourceCost(10000, 1000, supCost, infCost, resourceCount);
                     }
                 }
                 else
                 {
                     int supCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_1000").NumberValue;
                     int infCost = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100").NumberValue;
                     result = GamePlayUtil.CalculateResourceCost(1000, 100, supCost, infCost, resourceCount);
                 }
             }
             else
             {
                 result = ObjectManager.DataTables.GetGlobals().GetGlobalData("RESOURCE_DIAMOND_COST_100").NumberValue;
             }
         }
     }
     return result;
 }
コード例 #12
0
 public static int GetResourceDiamondCost(int resourceCount, ResourceData resourceData)
 {
     var globals = ObjectManager.DataTables.GetGlobals();
     return globals.GetResourceDiamondCost(resourceCount, resourceData);
 }