public override int Execute(LogicLevel level)
        {
            if (this.m_shieldData != null)
            {
                int cooldownSecs = level.GetCooldownManager().GetCooldownSeconds(this.m_shieldData.GetGlobalID());

                if (cooldownSecs <= 0)
                {
                    LogicClientAvatar playerAvatar = level.GetPlayerAvatar();

                    if (this.m_shieldData.GetScoreLimit() > playerAvatar.GetScore() || this.m_shieldData.GetScoreLimit() <= 0)
                    {
                        if (playerAvatar.HasEnoughDiamonds(this.m_shieldData.GetDiamondsCost(), true, level))
                        {
                            LogicGameMode gameMode = level.GetGameMode();

                            playerAvatar.UseDiamonds(this.m_shieldData.GetDiamondsCost());
                            playerAvatar.GetChangeListener().DiamondPurchaseMade(6, this.m_shieldData.GetGlobalID(), this.m_shieldData.GetTimeHours() * 3600,
                                                                                 this.m_shieldData.GetDiamondsCost(), level.GetVillageType());

                            int shieldTime    = gameMode.GetShieldRemainingSeconds() + this.m_shieldData.GetTimeHours() * 3600;
                            int guardTime     = gameMode.GetGuardRemainingSeconds();
                            int personalBreak = 0;

                            if (this.m_shieldData.GetTimeHours() <= 0)
                            {
                                if (shieldTime > 0)
                                {
                                    return(-2);
                                }

                                guardTime += this.m_shieldData.GetGuardTimeHours() * 3600;
                            }
                            else
                            {
                                LogicLeagueData leagueData = playerAvatar.GetLeagueTypeData();

                                if (playerAvatar.GetAttackShieldReduceCounter() != 0)
                                {
                                    playerAvatar.SetAttackShieldReduceCounter(0);
                                    playerAvatar.GetChangeListener().AttackShieldReduceCounterChanged(0);
                                }

                                if (playerAvatar.GetDefenseVillageGuardCounter() != 0)
                                {
                                    playerAvatar.SetDefenseVillageGuardCounter(0);
                                    playerAvatar.GetChangeListener().DefenseVillageGuardCounterChanged(0);
                                }

                                guardTime += leagueData.GetVillageGuardInMins() * 60;
                            }

                            if (shieldTime <= 0)
                            {
                                personalBreak = LogicMath.Min(LogicDataTables.GetGlobals().GetPersonalBreakLimitSeconds() + this.m_shieldData.GetGuardTimeHours() * 3600,
                                                              gameMode.GetPersonalBreakCooldownSeconds() + this.m_shieldData.GetGuardTimeHours() * 3600);
                            }
                            else
                            {
                                personalBreak = shieldTime + LogicDataTables.GetGlobals().GetPersonalBreakLimitSeconds();
                            }

                            gameMode.SetPersonalBreakCooldownSeconds(personalBreak);
                            gameMode.SetShieldRemainingSeconds(shieldTime);
                            gameMode.SetGuardRemainingSeconds(guardTime);

                            level.GetHome().GetChangeListener().ShieldActivated(shieldTime, guardTime);
                            level.GetCooldownManager().AddCooldown(this.m_shieldData.GetGlobalID(), this.m_shieldData.GetCooldownSecs());

                            return(0);
                        }
                    }
                }
            }

            return(-1);
        }