Пример #1
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

            this._width  = this.GetIntegerValue("Width", 0);
            this._height = this.GetIntegerValue("Height", 0);

            this._upgradeLevelCount = this._row.GetBiggestArraySize();

            this._buildCost         = new int[this._upgradeLevelCount];
            this._rearmCost         = new int[this._upgradeLevelCount];
            this._townHallLevel     = new int[this._upgradeLevelCount];
            this._strenghtWeight    = new int[this._upgradeLevelCount];
            this._damage            = new int[this._upgradeLevelCount];
            this._damageRadius      = new int[this._upgradeLevelCount];
            this._ejectHousingLimit = new int[this._upgradeLevelCount];
            this._numSpawns         = new int[this._upgradeLevelCount];
            this._constructionTimes = new int[this._upgradeLevelCount];

            for (int i = 0; i < this._upgradeLevelCount; i++)
            {
                this._buildCost[i]         = this.GetClampedIntegerValue("BuildCost", i);
                this._rearmCost[i]         = this.GetClampedIntegerValue("RearmCost", i);
                this._townHallLevel[i]     = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0);
                this._strenghtWeight[i]    = this.GetClampedIntegerValue("StrengthWeight", i);
                this._damage[i]            = LogicMath.Min(this.GetClampedIntegerValue("Damage", i), 1000);
                this._damageRadius[i]      = (this.GetClampedIntegerValue("DamageRadius", i) << 9) / 100;
                this._ejectHousingLimit[i] = this.GetIntegerValue("EjectHousingLimit", i);
                this._numSpawns[i]         = this.GetClampedIntegerValue("NumSpawns", i);
                this._constructionTimes[i] = 86400 * this.GetIntegerValue("BuildTimeD", i) +
                                             3600 * this.GetIntegerValue("BuildTimeH", i) +
                                             60 * this.GetIntegerValue("BuildTimeM", i) +
                                             this.GetIntegerValue("BuildTimeS", i);
            }

            this._preferredTargetData      = LogicDataTables.GetCharacterByName(this.GetValue("PreferredTarget", 0));
            this._preferredTargetDamageMod = this.GetIntegerValue("PreferredTargetDamageMod", 0);

            if (this._preferredTargetDamageMod == 0)
            {
                this._preferredTargetDamageMod = 100;
            }

            this._buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildResource", 0));

            if (this._buildResourceData == null)
            {
                Debugger.Error("build resource is not defined for trap: " + this.GetName());
            }

            this._ejectVictims               = this.GetBooleanValue("EjectVictims", 0);
            this._actionFrame                = 1000 * this.GetIntegerValue("ActionFrame", 0) / 24;
            this._pushback                   = this.GetIntegerValue("Pushback", 0);
            this._doNotScalePushByDamage     = this.GetBooleanValue("DoNotScalePushByDamage", 0);
            this._effectData                 = LogicDataTables.GetEffectByName(this.GetValue("Effect", 0));
            this._effect2Data                = LogicDataTables.GetEffectByName(this.GetValue("Effect2", 0));
            this._effectBrokenData           = LogicDataTables.GetEffectByName(this.GetValue("EffectBroken", 0));
            this._damageEffectData           = LogicDataTables.GetEffectByName(this.GetValue("DamageEffect", 0));
            this._pickUpEffectData           = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0));
            this._placingEffectData          = LogicDataTables.GetEffectByName(this.GetValue("PlacingEffect", 0));
            this._appearEffectData           = LogicDataTables.GetEffectByName(this.GetValue("AppearEffect", 0));
            this._toggleAttackModeEffectData = LogicDataTables.GetEffectByName(this.GetValue("ToggleAttackModeEffect", 0));
            this._triggerRadius              = (this.GetIntegerValue("TriggerRadius", 0) << 9) / 100;
            this._directionCount             = this.GetIntegerValue("DirectionCount", 0);
            this._spell                  = LogicDataTables.GetSpellByName(this.GetValue("Spell", 0));
            this._airTrigger             = this.GetBooleanValue("AirTrigger", 0);
            this._groundTrigger          = this.GetBooleanValue("GroundTrigger", 0);
            this._healerTrigger          = this.GetBooleanValue("HealerTrigger", 0);
            this._speedMod               = this.GetIntegerValue("SpeedMod", 0);
            this._damageMod              = this.GetIntegerValue("DamageMod", 0);
            this._durationMS             = this.GetIntegerValue("DurationMS", 0);
            this._hitDelayMS             = this.GetIntegerValue("HitDelayMS", 0);
            this._hitCount               = this.GetIntegerValue("HitCnt", 0);
            this._minTriggerHousingLimit = this.GetIntegerValue("MinTriggerHousingLimit", 0);
            this._spawnedCharGroundData  = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharGround", 0));
            this._spawnedCharAirData     = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharAir", 0));
            this._timeBetweenSpawnsMS    = this.GetIntegerValue("TimeBetweenSpawnsMs", 0);
            this._spawnInitialDelayMS    = this.GetIntegerValue("SpawnInitialDelayMs", 0);
            this._throwDistance          = this.GetIntegerValue("ThrowDistance", 0);
            this._hasAltMode             = this.GetBooleanValue("HasAltMode", 0);
            this._enableByCalendar       = this.GetBooleanValue("EnabledByCalendar", 0);

            if (this._enableByCalendar)
            {
                if (this._upgradeLevelCount > 1)
                {
                    Debugger.Error("Temporary traps should not have upgrade levels!");
                }
            }
        }
Пример #2
0
        /// <summary>
        ///     Creates a new data item.
        /// </summary>
        public LogicData CreateItem(CSVRow row)
        {
            LogicData data = null;

            switch (this._tableIndex)
            {
            case 0:
            {
                data = new LogicBuildingData(row, this);
                break;
            }

            case 1:
            {
                data = new LogicLocaleData(row, this);
                break;
            }

            case 2:
            {
                data = new LogicResourceData(row, this);
                break;
            }

            case 3:
            {
                data = new LogicCharacterData(row, this);
                break;
            }

            case 5:
            {
                data = new LogicProjectileData(row, this);
                break;
            }

            case 6:
            {
                data = new LogicBuildingClassData(row, this);
                break;
            }

            case 7:
            {
                data = new LogicObstacleData(row, this);
                break;
            }

            case 8:
            {
                data = new LogicEffectData(row, this);
                break;
            }

            case 9:
            {
                data = new LogicParticleEmitterData(row, this);
                break;
            }

            case 10:
            {
                data = new LogicExperienceLevelData(row, this);
                break;
            }

            case 11:
            {
                data = new LogicTrapData(row, this);
                break;
            }

            case 12:
            {
                data = new LogicAllianceBadgeData(row, this);
                break;
            }

            case 13:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case 14:
            {
                data = new LogicTownhallLevelData(row, this);
                break;
            }

            case 15:
            {
                data = new LogicAlliancePortalData(row, this);
                break;
            }

            case 16:
            {
                data = new LogicNpcData(row, this);
                break;
            }

            case 17:
            {
                data = new LogicDecoData(row, this);
                break;
            }

            case 18:
            {
                data = new LogicResourcePackData(row, this);
                break;
            }

            case 19:
            {
                data = new LogicShieldData(row, this);
                break;
            }

            case 20:
            {
                data = new LogicMissionData(row, this);
                break;
            }

            case 21:
            {
                data = new LogicBillingPackageData(row, this);
                break;
            }

            case 22:
            {
                data = new LogicAchievementData(row, this);
                break;
            }

            case 23:
            {
                data = new LogicFaqData(row, this);
                break;
            }

            case 25:
            {
                data = new LogicSpellData(row, this);
                break;
            }

            case 26:
            {
                data = new LogicHintData(row, this);
                break;
            }

            case 27:
            {
                data = new LogicHeroData(row, this);
                break;
            }

            case 28:
            {
                data = new LogicLeagueData(row, this);
                break;
            }

            case 29:
            {
                data = new LogicNewsData(row, this);
                break;
            }

            case 30:
            {
                data = new LogicWarData(row, this);
                break;
            }

            case 31:
            {
                data = new LogicRegionData(row, this);
                break;
            }

            case 32:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case 33:
            {
                data = new LogicAllianceBadgeLayerData(row, this);
                break;
            }

            case 34:
            {
                data = new LogicAllianceLevelData(row, this);
                break;
            }

            case 36:
            {
                data = new LogicVariableData(row, this);
                break;
            }

            case 37:
            {
                data = new LogicGemBundleData(row, this);
                break;
            }

            case 38:
            {
                data = new LogicVillageObjectData(row, this);
                break;
            }

            case 39:
            {
                data = new LogicCalendarEventFunctionData(row, this);
                break;
            }

            case 40:
            {
                data = new LogicBoomboxData(row, this);
                break;
            }

            case 41:
            {
                data = new LogicEventEntryData(row, this);
                break;
            }

            case 42:
            {
                data = new LogicDeeplinkData(row, this);
                break;
            }

            case 43:
            {
                data = new LogicLeague2Data(row, this);
                break;
            }

            default:
            {
                Debugger.Error("Invalid data table id: " + this._tableIndex);
                break;
            }
            }

            return(data);
        }