Esempio n. 1
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (!entityStatus.TryGetCompanion(companionDefId, out ReserveCompanionStatus companionStatus))
         {
             Log.Error(FightEventErrors.ReserveCompanionNotFound(companionDefId, concernedEntity), 19, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReserveStateChangedEvent.cs");
         }
         m_wasGiven = companionStatus.isGiven;
         if (m_wasGiven && state == CompanionReserveState.Dead)
         {
             entityStatus.RemoveAdditionalCompanion(companionDefId);
         }
         else
         {
             companionStatus.SetState(state);
         }
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             if (m_wasGiven && state == CompanionReserveState.Dead)
             {
                 view.RemoveAdditionalCompanionStatus(companionDefId);
             }
             else
             {
                 view.ChangeCompanionStateStatus(companionDefId, state);
             }
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 48, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReserveStateChangedEvent.cs");
     }
 }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (entityStatus.TryGetCompanion(companionDefId, out ReserveCompanionStatus companionStatus))
         {
             if (FightLogicExecutor.GetFightStatus(toFightId).TryGetEntity(toPlayerId, out PlayerStatus entityStatus2))
             {
                 AbstractPlayerUIRework view = entityStatus2.view;
                 if (null != view)
                 {
                     yield return(view.AddAdditionalCompanion(entityStatus, companionDefId, companionStatus.level));
                 }
             }
             else
             {
                 Log.Error(FightEventErrors.PlayerNotFound(toPlayerId, toFightId), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
             }
         }
         else
         {
             Log.Error(FightEventErrors.ReserveCompanionNotFound(companionDefId, concernedEntity), 67, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 72, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
     }
 }
Esempio n. 3
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            PlayerType   playerType   = (PlayerType)(isLocalPlayer ? 13 : (((teamIndex == GameStatus.localPlayerTeamIndex) ? 1 : 2) | ((fightStatus == FightStatus.local) ? 4 : 0)));
            PlayerStatus playerStatus = new PlayerStatus(concernedEntity, fightStatus.fightId, index, teamId, teamIndex, name, playerType);

            fightStatus.AddEntity(playerStatus);
            playerStatus.SetCarac(CaracId.ActionPoints, baseActionPoints);
            if (isLocalPlayer)
            {
                fightStatus.localPlayerId = concernedEntity;
                CameraHandler current = CameraHandler.current;
                if (null != current)
                {
                    DirectionAngle mapRotation = GameStatus.GetMapRotation(playerStatus);
                    current.ChangeRotation(mapRotation);
                }
            }
            FightUIRework instance = FightUIRework.instance;

            if (null != instance)
            {
                AbstractPlayerUIRework abstractPlayerUIRework2 = playerStatus.view = ((!isLocalPlayer) ? ((AbstractPlayerUIRework)instance.AddPlayer(playerStatus)) : ((AbstractPlayerUIRework)instance.GetLocalPlayerUI(playerStatus)));
                abstractPlayerUIRework2.SetPlayerStatus(playerStatus);
                abstractPlayerUIRework2.SetPlayerName(playerStatus.nickname);
                abstractPlayerUIRework2.SetRankIcon(0);
                abstractPlayerUIRework2.SetActionPoints(baseActionPoints);
                abstractPlayerUIRework2.SetReservePoints(0);
                abstractPlayerUIRework2.SetElementaryPoints(0, 0, 0, 0);
            }
        }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (!(null != view))
         {
             yield break;
         }
         int count = companionDefId.Count;
         if (count > 0)
         {
             IEnumerator[] array = new IEnumerator[count];
             for (int i = 0; i < count; i++)
             {
                 array[i] = view.AddCompanion(companionDefId[i], levels[i], i);
             }
             yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedInReserveEvent.cs");
     }
 }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             int           count = moves.Count;
             IEnumerator[] array = new IEnumerator[count];
             for (int i = 0; i < count; i++)
             {
                 SpellMovement spellMovement = moves[i];
                 if (spellMovement.From == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                 {
                     int spellInstanceId = spellMovement.Spell.SpellInstanceId;
                     array[i] = view.RemoveSpell(spellInstanceId, i);
                 }
                 else if (spellMovement.To == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                 {
                     array[i] = view.AddSpell(spellMovement.Spell, i);
                 }
             }
             yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 112, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellsMovedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.SpellsMoved);
 }
        public override void UpdateStatus(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
            {
                bool flag  = fightStatus == FightStatus.local;
                int  count = moves.Count;
                for (int i = 0; i < count; i++)
                {
                    SpellMovement spellMovement = moves[i];
                    if (flag)
                    {
                        FightCastManager.CheckSpellPlayed(spellMovement.Spell.SpellInstanceId);
                    }
                    switch (spellMovement.To)
                    {
                    case Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Nowhere:
                    case Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Deck:
                        if (spellMovement.From == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                        {
                            int spellInstanceId = spellMovement.Spell.SpellInstanceId;
                            entityStatus.RemoveSpell(spellInstanceId);
                            AbstractPlayerUIRework view2 = entityStatus.view;
                            if (null != view2)
                            {
                                view2.RemoveSpellStatus(spellInstanceId, i);
                            }
                        }
                        break;

                    case Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand:
                    {
                        SpellInfo   spell       = spellMovement.Spell;
                        SpellStatus spellStatus = SpellStatus.TryCreate(spell, entityStatus);
                        if (spellStatus != null)
                        {
                            entityStatus.AddSpell(spellStatus);
                            AbstractPlayerUIRework view = entityStatus.view;
                            if (null != view)
                            {
                                view.AddSpellStatus(spell, i);
                            }
                        }
                        break;
                    }

                    default:
                        throw new ArgumentOutOfRangeException($"Spell moved to unknown zone: {spellMovement.To}");
                    }
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 75, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellsMovedEvent.cs");
            }
            FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.SpellsMoved);
        }
 private IEnumerator PropertyViewChanged(FightStatus fightStatus, PropertyId property)
 {
     if (property == PropertyId.PlaySpellForbidden && fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             yield return(view.UpdateAvailableActions(recomputeSpellCosts: false));
         }
     }
 }
 private void PropertyStatusChanged(FightStatus fightStatus, PropertyId property)
 {
     if (property == PropertyId.PlaySpellForbidden && fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             view.RefreshAvailableActions(recomputeSpellCosts: false);
         }
     }
     if (PropertiesUtility.PreventsAction(property))
     {
         fightStatus.NotifyEntityPlayableStateChanged();
     }
 }
Esempio n. 9
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            fightStatus.currentTurnPlayerId = 0;
            if (fightStatus != FightStatus.local || fightStatus.localPlayerId != concernedEntity)
            {
                return;
            }
            switch (FightCastManager.currentCastType)
            {
            case FightCastManager.CurrentCastType.Spell:
                FightCastManager.StopCastingSpell(cancelled: true);
                break;

            case FightCastManager.CurrentCastType.Companion:
                FightCastManager.StopInvokingCompanion(cancelled: true);
                break;

            default:
                throw new ArgumentOutOfRangeException();

            case FightCastManager.CurrentCastType.None:
                break;
            }
            FightMap current = FightMap.current;

            if (null != current)
            {
                current.SetNoInteractionPhase();
            }
            FightUIRework instance = FightUIRework.instance;

            if (null != instance)
            {
                instance.EndLocalPlayerTurn();
            }
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
            {
                AbstractPlayerUIRework view = entityStatus.view;
                if (null != view)
                {
                    view.SetUIInteractable(interactable: false);
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 60, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TurnEndedEvent.cs");
            }
        }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         entityStatus.RemoveSpellCostModifier(stoppedModifierId);
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             view.RefreshAvailableActions(recomputeSpellCosts: true);
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 25, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellCostModifierRemovedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.SpellCostModification);
 }
Esempio n. 11
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             view.ChangeActionPoints(valueAfter);
             yield return(view.UpdateAvailableActions(recomputeSpellCosts: false));
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 50, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ActionPointsChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.ActionPointsChanged);
 }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             view.ChangeReservePoints(valueAfter);
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 49, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ReservePointsChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.ReserveChanged);
     yield break;
 }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
     {
         IObjectWithArmoredLife objectWithArmoredLife;
         if ((objectWithArmoredLife = (entityStatus.view as IObjectWithArmoredLife)) != null)
         {
             objectWithArmoredLife.SetBaseLife(maxLifeAfter);
         }
         else
         {
             Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithArmoredLife>(entityStatus), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
         }
         if (entityStatus.type == EntityType.Hero)
         {
             HeroStatus heroStatus = (HeroStatus)entityStatus;
             if (heroStatus.ownerId == fightStatus.localPlayerId)
             {
                 FightMap current = FightMap.current;
                 if (null != current)
                 {
                     current.SetLocalPlayerHeroLife(heroStatus.life, maxLifeAfter);
                 }
             }
             if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
             {
                 AbstractPlayerUIRework view = entityStatus2.view;
                 if (null != view)
                 {
                     view.ChangeHeroBaseLifePoints(maxLifeAfter);
                 }
             }
             else
             {
                 Log.Error(FightEventErrors.PlayerNotFound(heroStatus.ownerId), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
             }
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.LifeArmorChanged);
     yield break;
 }
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
            {
                AbstractPlayerUIRework playerUI = entityStatus.view;
                if (null != playerUI)
                {
                    yield return(playerUI.RemoveSpellCostModifier(stoppedModifierId));

                    yield return(playerUI.UpdateAvailableActions(recomputeSpellCosts: true));
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 45, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellCostModifierRemovedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.SpellCostModification);
        }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (entityStatus.reservePoints != valueBefore)
         {
             Log.Warning($"The previous reserve points value ({entityStatus.reservePoints}) for player with id {concernedEntity} doesn't match the value in the event ({valueBefore}).", 17, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ReservePointsChangedEvent.cs");
         }
         entityStatus.SetCarac(CaracId.ReservePoints, valueAfter);
         AbstractPlayerUIRework view = entityStatus.view;
         if (!(null != view))
         {
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 31, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ReservePointsChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.ReserveChanged);
 }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         entityStatus.SetAvailableCompanions(companionDefId, levels);
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             int count = companionDefId.Count;
             for (int i = 0; i < count; i++)
             {
                 view.AddCompanionStatus(companionDefId[i], levels[i], i);
             }
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 32, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedInReserveEvent.cs");
     }
 }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         CaracId element = (CaracId)this.element;
         if (entityStatus.GetCarac(element) != valueBefore)
         {
             Log.Warning($"The previous element points value ({entityStatus.GetCarac(element)}) for player with id {concernedEntity} doesn't match the value in the event ({valueBefore}).", 20, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ElementPointsChangedEvent.cs");
         }
         entityStatus.SetCarac(element, valueAfter);
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             view.RefreshAvailableCompanions();
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 33, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ElementPointsChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.ElementPointsChanged);
 }
Esempio n. 18
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             if (m_wasGiven && state == CompanionReserveState.Dead)
             {
                 yield return(view.RemoveAdditionalCompanion(companionDefId));
             }
             else
             {
                 yield return(view.ChangeCompanionState(companionDefId, state));
             }
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 71, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReserveStateChangedEvent.cs");
     }
 }
Esempio n. 19
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            fightStatus.currentTurnPlayerId = concernedEntity;
            foreach (CharacterStatus item in fightStatus.EnumerateEntities((CharacterStatus c) => c.ownerId == concernedEntity))
            {
                item.actionUsed = false;
            }
            fightStatus.NotifyEntityPlayableStateChanged();
            if (fightStatus != FightStatus.local || fightStatus.localPlayerId != concernedEntity)
            {
                return;
            }
            FightMap current = FightMap.current;

            if (null != current)
            {
                current.SetMovementPhase();
            }
            FightUIRework instance = FightUIRework.instance;

            if (null != instance)
            {
                instance.StartLocalPlayerTurn();
            }
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
            {
                AbstractPlayerUIRework view = entityStatus.view;
                if (null != view)
                {
                    view.SetUIInteractable(interactable: true);
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 55, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TurnStartedEvent.cs");
            }
        }
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
            {
                AbstractPlayerUIRework view = entityStatus.view;
                if (null != view)
                {
                    switch (element)
                    {
                    case 14:
                        view.ChangeAirElementaryPoints(valueAfter);
                        break;

                    case 13:
                        view.ChangeEarthElementaryPoints(valueAfter);
                        break;

                    case 11:
                        view.ChangeFireElementaryPoints(valueAfter);
                        break;

                    case 12:
                        view.ChangeWaterElementaryPoints(valueAfter);
                        break;

                    default:
                        throw new ArgumentException();
                    }
                    yield return(view.UpdateAvailableCompanions());
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 70, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ElementPointsChangedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.ElementPointsChanged);
        }
Esempio n. 21
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     //IL_0046: Unknown result type (might be due to invalid IL or missing references)
     if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
     {
         Gender gender = (Gender)this.gender;
         if (RuntimeData.weaponDefinitions.TryGetValue(entityDefId, out WeaponDefinition value))
         {
             HeroStatus heroStatus = HeroStatus.Create(concernedEntity, value, level, gender, entityStatus, (Vector2Int)refCoord);
             fightStatus.AddEntity(heroStatus);
             entityStatus.heroStatus = heroStatus;
             AbstractPlayerUIRework view = entityStatus.view;
             if (null != view)
             {
                 view.SetHeroIllustration(value, gender);
                 view.SetHeroStartLifePoints(heroStatus.baseLife, entityStatus.playerType);
                 if (RuntimeData.reserveDefinitions.TryGetValue(value.god, out ReserveDefinition value2))
                 {
                     view.SetupReserve(heroStatus, value2);
                 }
                 else
                 {
                     Log.Error(FightEventErrors.DefinitionNotFound <ReserveDefinition>((int)value.god), 45, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
                 }
             }
         }
         else
         {
             Log.Error(FightEventErrors.EntityCreationFailed <HeroStatus, WeaponDefinition>(concernedEntity, entityDefId), 51, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(ownerId), 56, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
Esempio n. 22
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            int fightId = fightStatus.fightId;

            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                int change = 0;
                int num    = 0;
                int num2   = 0;
                LifeModificationType lifeModificationType = LifeModificationType.Undefined;
                if (armorAfter.HasValue)
                {
                    num = armorAfter.Value;
                    if (armorBefore.HasValue)
                    {
                        int value = armorBefore.Value;
                        change += num - value;
                        if (value > num)
                        {
                            lifeModificationType = LifeModificationType.Damage;
                        }
                        else if (value < num)
                        {
                            lifeModificationType = LifeModificationType.ArmorGain;
                        }
                    }
                }
                if (lifeAfter.HasValue)
                {
                    num2 = lifeAfter.Value;
                    if (lifeBefore.HasValue)
                    {
                        int value2 = lifeBefore.Value;
                        change += num2 - value2;
                        if (value2 > num2)
                        {
                            lifeModificationType = ((num2 > 0) ? LifeModificationType.Damage : LifeModificationType.Death);
                        }
                        else if (value2 < num2)
                        {
                            lifeModificationType = ((entityStatus.type == EntityType.ObjectMechanism) ? LifeModificationType.ArmorGain : LifeModificationType.Heal);
                        }
                    }
                }
                if (lifeAfter.HasValue && entityStatus.type == EntityType.Hero)
                {
                    HeroStatus heroStatus = (HeroStatus)entityStatus;
                    if (heroStatus.ownerId == fightStatus.localPlayerId)
                    {
                        FightMap current = FightMap.current;
                        if (null != current)
                        {
                            current.SetLocalPlayerHeroLife(num2, heroStatus.baseLife);
                        }
                    }
                    if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
                    {
                        AbstractPlayerUIRework view = entityStatus2.view;
                        if (null != view)
                        {
                            view.ChangeHeroLifePoints(num2);
                        }
                        TryDrawLowLifeMessage(num2, entityStatus2);
                    }
                }
                IsoObject isoObject = entityStatus.view;
                if (null != isoObject)
                {
                    IObjectWithArmoredLife objectWithArmoredLife2;
                    IObjectWithArmoredLife objectWithArmoredLife = objectWithArmoredLife2 = (isoObject as IObjectWithArmoredLife);
                    if (objectWithArmoredLife2 != null)
                    {
                        int life  = lifeAfter.HasValue ? num2 : objectWithArmoredLife.life;
                        int armor = armorAfter.HasValue ? num : objectWithArmoredLife.armor;
                        objectWithArmoredLife.SetArmoredLife(life, armor);
                    }
                    else
                    {
                        Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithArmoredLife>(entityStatus), 151, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
                        objectWithArmoredLife = null;
                    }
                    switch (lifeModificationType)
                    {
                    case LifeModificationType.ArmorGain:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.ArmorGain, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Heal, isoObject.cellObject.get_transform());
                        break;

                    case LifeModificationType.Damage:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Damage, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Damage, isoObject.cellObject.get_transform());
                        if (objectWithArmoredLife != null)
                        {
                            yield return(objectWithArmoredLife.Hit(isoObject.area.refCoord));
                        }
                        break;

                    case LifeModificationType.Heal:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Heal, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Heal, isoObject.cellObject.get_transform());
                        break;

                    case LifeModificationType.Death:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Damage, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Damage, isoObject.cellObject.get_transform());
                        objectWithArmoredLife?.LethalHit(isoObject.area.refCoord);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();

                    case LifeModificationType.Undefined:
                        break;
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 197, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 202, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightId, EventCategory.LifeArmorChanged);
        }
Esempio n. 23
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                IsoObject view = entityStatus.view;
                if (null != view)
                {
                    switch (reason)
                    {
                    case 2:
                    case 4:
                    case 6:
                    case 8:
                    case 9:
                    {
                        ICharacterObject characterObject2;
                        if ((characterObject2 = (view as ICharacterObject)) != null)
                        {
                            yield return(characterObject2.Die());
                        }
                        HeroStatus heroStatus;
                        if ((heroStatus = (entityStatus as HeroStatus)) == null)
                        {
                            break;
                        }
                        if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
                        {
                            AbstractPlayerUIRework view2 = entityStatus2.view;
                            if (null != view2)
                            {
                                view2.ChangeHeroLifePoints(0);
                            }
                            if (GameStatus.fightType == FightType.BossFight)
                            {
                                FightUIRework instance = FightUIRework.instance;
                                if (null != instance)
                                {
                                    FightInfoMessage message = FightInfoMessage.HeroDeath(MessageInfoRibbonGroup.MyID);
                                    instance.DrawInfoMessage(message, entityStatus2.nickname);
                                }
                            }
                        }
                        else
                        {
                            Log.Error(FightEventErrors.PlayerNotFound(heroStatus.ownerId), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                        }
                        break;
                    }

                    case 7:
                    {
                        IObjectWithActivation objectWithActivation;
                        if ((objectWithActivation = (view as IObjectWithActivation)) != null)
                        {
                            yield return(objectWithActivation.WaitForActivationEnd());
                        }
                        else
                        {
                            Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithActivation>(entityStatus), 82, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                        }
                        break;
                    }

                    case 5:
                    {
                        ICharacterObject characterObject;
                        if ((characterObject = (view as ICharacterObject)) != null)
                        {
                            yield return(characterObject.Die());
                        }
                        else
                        {
                            Log.Error(FightEventErrors.EntityHasIncompatibleView <ICharacterObject>(entityStatus), 95, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                        }
                        break;
                    }

                    case 3:
                        throw new ArgumentException("Transformations should not trigger an EntityRemovedEvent.");

                    default:
                        throw new ArgumentOutOfRangeException($"EntityRemovedReason not handled: {reason}");

                    case 1:
                        break;
                    }
                    view.DetachFromCell();
                    view.Destroy();
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 112, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 117, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }