Ejemplo n.º 1
0
        public EatResponse OnEvent(EventId id, object cookie)
        {
            switch (id)
            {
            case EventId.BattleReplaySetup:
            {
                BattleRecord battleRecord = (BattleRecord)cookie;
                ArmoryController.AddEquipmentBuffs(battleRecord.AttackerEquipment, battleRecord.DefenderEquipment);
                return(EatResponse.NotEaten);
            }

            case EventId.BattleRecordRetrieved:
            {
                GetReplayResponse getReplayResponse = (GetReplayResponse)cookie;
                BattleRecord      replayData        = getReplayResponse.ReplayData;
                ArmoryController.AddEquipmentBuffs(replayData.AttackerEquipment, replayData.DefenderEquipment);
                return(EatResponse.NotEaten);
            }

            case EventId.BattleLeftBeforeStarting:
            case EventId.BattleReplayEnded:
                goto IL_150;

            case EventId.BattleLoadedForDefend:
                break;

            default:
                switch (id)
                {
                case EventId.EquipmentUnlocked:
                    this.pendingCelebrationEquipment = (cookie as EquipmentVO);
                    this.UpdateLastEquipmentUnlocked(this.pendingCelebrationEquipment.Uid);
                    if (this.AllowUnlockCelebration)
                    {
                        if (GameUtils.IsUnlockBlockingScreenOpen())
                        {
                            Service.EventManager.RegisterObserver(this, EventId.ScreenClosing);
                        }
                        else
                        {
                            bool immediate = GameUtils.CanShardUnlockCelebrationPlayImmediately();
                            this.ShowEquipmentUnlockedCelebration(immediate);
                        }
                    }
                    return(EatResponse.NotEaten);

                case EventId.EquipmentUpgraded:
                {
                    ContractEventData    contractEventData    = cookie as ContractEventData;
                    StaticDataController staticDataController = Service.StaticDataController;
                    EquipmentVO          equipmentVO          = staticDataController.Get <EquipmentVO>(contractEventData.Contract.ProductUid);
                    this.UpdateActiveArmoryLevel(equipmentVO);
                    return(EatResponse.NotEaten);
                }

                case EventId.EquipmentActivated:
                case EventId.EquipmentDeactivated:
                    this.UpdateArmoryBuildingTooltip();
                    return(EatResponse.NotEaten);

                default:
                    switch (id)
                    {
                    case EventId.ScreenClosing:
                        if (cookie is InventoryCrateCollectionScreen)
                        {
                            GameUtils.CloseStoreOrInventoryScreen();
                            Service.EventManager.UnregisterObserver(this, EventId.ScreenClosing);
                            if (this.AllowUnlockCelebration)
                            {
                                this.ShowEquipmentUnlockedCelebration(false);
                            }
                        }
                        return(EatResponse.NotEaten);

                    case EventId.ScreenClosed:
                    case EventId.ScreenOverlayClosing:
                    {
IL_58:
                        if (id == EventId.BattleLoadStart)
                        {
                            goto IL_E3;
                        }
                        if (id == EventId.BattleEndFullyProcessed)
                        {
                            goto IL_150;
                        }
                        if (id != EventId.PlanetConfirmRelocate)
                        {
                            return(EatResponse.NotEaten);
                        }
                        CurrentPlayer        currentPlayer         = Service.CurrentPlayer;
                        StaticDataController staticDataController2 = Service.StaticDataController;
                        for (int i = currentPlayer.ActiveArmory.Equipment.Count - 1; i >= 0; i--)
                        {
                            EquipmentVO equipment = staticDataController2.Get <EquipmentVO>(currentPlayer.ActiveArmory.Equipment[i]);
                            if (!ArmoryUtils.IsEquipmentValidForPlanet(equipment, (string)cookie))
                            {
                                this.DeactivateEquipmentOnClient(currentPlayer, equipment);
                            }
                        }
                        return(EatResponse.NotEaten);
                    }

                    case EventId.ScreenLoaded:
                        if (cookie is ArmoryScreen)
                        {
                            this.UpdateLastEquipmentUnlocked("false");
                        }
                        return(EatResponse.NotEaten);
                    }
                    goto IL_58;
                }
                break;
            }
IL_E3:
            CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle();

            ArmoryController.AddEquipmentBuffs(currentBattle.AttackerEquipment, currentBattle.DefenderEquipment);
            return(EatResponse.NotEaten);

IL_150:
            Service.BuffController.ClearEquipmentBuffs();
            return(EatResponse.NotEaten);
        }
Ejemplo n.º 2
0
 public unsafe static long $Invoke1(long instance, long *args)
 {
     ArmoryController.AddEquipmentBuffs((List <string>)GCHandledObjects.GCHandleToObject(*args), (List <string>)GCHandledObjects.GCHandleToObject(args[1]));
     return(-1L);
 }