Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus != FightStatus.local)
            {
                yield break;
            }
            FightUIRework instance = FightUIRework.instance;

            if (!(null != instance))
            {
                yield break;
            }
            if (GameStatus.GetFightStatus(fromFightId).TryGetEntity(fromPlayerId, out PlayerStatus entityStatus))
            {
                if (RuntimeData.companionDefinitions.TryGetValue(companionDefId, out CompanionDefinition value))
                {
                    PlayerStatus localPlayer = fightStatus.GetLocalPlayer();
                    if (concernedEntity == localPlayer.id)
                    {
                        FightInfoMessage message = FightInfoMessage.ReceivedCompanion(MessageInfoRibbonGroup.MyID);
                        instance.DrawInfoMessage(message, entityStatus.nickname, RuntimeData.FormattedText(value.i18nNameId));
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.DefinitionNotFound <CompanionDefinition>(companionDefId), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReceivedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(fromPlayerId, fromFightId), 42, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReceivedEvent.cs");
            }
        }
Ejemplo n.º 3
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (entityStatus.TryGetSpell(spellInstanceId, out SpellStatus spellStatus))
         {
             if (null == spellStatus.definition)
             {
                 if (RuntimeData.spellDefinitions.TryGetValue(spellDefId, out SpellDefinition value))
                 {
                     spellStatus.Upgrade(value, spellLevel);
                 }
                 else
                 {
                     Log.Error(FightEventErrors.DefinitionNotFound <SpellDefinition>(spellDefId), 31, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
                 }
             }
         }
         else
         {
             Log.Error($"Could not find spell with instance id {spellInstanceId} for player with id {concernedEntity}.", 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 42, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
     }
 }
 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");
     }
 }
Ejemplo n.º 5
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out CompanionStatus companionStatus))
     {
         if (fightStatus.TryGetEntity(ownerId, out PlayerStatus ownerStatus))
         {
             if (!ownerStatus.isLocalPlayer)
             {
                 FightMap current = FightMap.current;
                 if (null != current)
                 {
                     if (current.TryGetCellObject(refCoord.X, refCoord.Y, out CellObject cellObject))
                     {
                         ReserveCompanionStatus reserveCompanion = new ReserveCompanionStatus(ownerStatus, (CompanionDefinition)companionStatus.definition, level);
                         yield return(FightUIRework.ShowPlayingCompanion(reserveCompanion, cellObject));
                     }
                     else
                     {
                         Log.Error(FightEventErrors.InvalidPosition(refCoord), 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
                     }
                 }
             }
             yield return(CreateCompanionCharacterObject(fightStatus, companionStatus, ownerStatus, refCoord.X, refCoord.Y, (Direction)direction));
         }
         else
         {
             Log.Error(FightEventErrors.PlayerNotFound(ownerId), 70, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <CompanionStatus>(concernedEntity), 75, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
Ejemplo n.º 6
0
 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");
     }
 }
Ejemplo n.º 7
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out HeroStatus heroStatus))
            {
                if (fightStatus.TryGetEntity(ownerId, out PlayerStatus ownerStatus))
                {
                    WeaponDefinition weaponDefinition = (WeaponDefinition)heroStatus.definition;
                    if (null != weaponDefinition)
                    {
                        HeroCharacterObject heroCharacterObject = FightObjectFactory.CreateHeroCharacterObject(weaponDefinition, refCoord.X, refCoord.Y, (Direction)direction);
                        if (null != heroCharacterObject)
                        {
                            heroStatus.view = heroCharacterObject;
                            yield return(heroCharacterObject.LoadAnimationDefinitions(skinId, (Gender)gender));

                            heroCharacterObject.Initialize(fightStatus, ownerStatus, heroStatus);
                            UpdateAudioContext(ownerStatus, heroStatus.baseLife);
                            yield return(heroCharacterObject.Spawn());
                        }
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.PlayerNotFound(ownerId), 98, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <HeroStatus>(concernedEntity), 103, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }
Ejemplo n.º 8
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");
     }
 }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            fightStatus.RemoveEntity(concernedEntity);
            if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
            {
                EntityType   newEntityType = (EntityType)this.newEntityType;
                EntityStatus entityStatus2;
                switch (newEntityType)
                {
                case EntityType.Hero:
                    throw new Exception("[TransformationEvent] Heroes cannot be transformed.");

                case EntityType.Companion:
                    entityStatus2 = CompanionAddedEvent.CreateCompanionStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.Summoning:
                    entityStatus2 = SummoningAddedEvent.CreateSummoningStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.FloorMechanism:
                    entityStatus2 = FloorMechanismAddedEvent.CreateFloorMechanismStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.ObjectMechanism:
                    entityStatus2 = ObjectMechanismAddedEvent.CreateObjectMechanismStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.Global:
                case EntityType.Player:
                case EntityType.Team:
                    Log.Error($"Transformation not handled for type {newEntityType}.", 48, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
                    return;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                IEntityWithAction entityWithAction;
                if (copyActionUsed && fightStatus.TryGetEntity(concernedEntity, out IEntityWithAction entityStatus3) && (entityWithAction = (entityStatus2 as IEntityWithAction)) != null)
                {
                    entityWithAction.actionUsed = entityStatus3.actionUsed;
                    fightStatus.NotifyEntityPlayableStateChanged();
                }
                fightStatus.AddEntity(entityStatus2);
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(ownerId), 72, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
            }
            FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }
Ejemplo n.º 11
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(ownerId, out PlayerStatus entityStatus))
     {
         FloorMechanismStatus floorMechanismStatus = CreateFloorMechanismStatus(concernedEntity, entityDefId, level, entityStatus, refCoord);
         if (floorMechanismStatus != null)
         {
             fightStatus.AddEntity(floorMechanismStatus);
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(ownerId), 25, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
 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;
 }
Ejemplo n.º 14
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (GameStatus.GetFightStatus(sourceFightId).TryGetEntity(sourcePlayerId, out PlayerStatus entityStatus))
     {
         FightUIRework instance = FightUIRework.instance;
         if (null != instance)
         {
             FightInfoMessage message = FightInfoMessage.BossPointEarn(MessageInfoRibbonGroup.MyID, valueBefore - valueAfter);
             instance.DrawScore(message, entityStatus.nickname);
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(sourcePlayerId, sourceFightId), 29, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\BossLifeModificationEvent.cs");
     }
     yield break;
 }
Ejemplo n.º 15
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 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);
 }
Ejemplo n.º 17
0
 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 IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out FloorMechanismStatus entityStatus))
     {
         if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus2))
         {
             yield return(CreateFloorMechanismObject(fightStatus, entityStatus, entityStatus2, refCoord.X, refCoord.Y));
         }
         else
         {
             Log.Error(FightEventErrors.PlayerNotFound(ownerId), 43, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismAddedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <FloorMechanismStatus>(concernedEntity), 48, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
 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");
     }
 }
Ejemplo n.º 22
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
     {
         CompanionStatus companionStatus = CreateCompanionStatus(concernedEntity, entityDefId, level, entityStatus, refCoord);
         if (companionStatus != null)
         {
             fightStatus.AddEntity(companionStatus);
         }
         if (entityStatus.isLocalPlayer)
         {
             FightCastManager.CheckCompanionInvoked(entityDefId);
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(ownerId), 32, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
 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);
 }
Ejemplo n.º 24
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");
     }
 }
        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);
        }
Ejemplo n.º 26
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");
            }
        }
Ejemplo n.º 27
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);
 }
Ejemplo n.º 28
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus playerStatus))
            {
                if (playerStatus.TryGetSpell(spellInstanceId, out SpellStatus spellStatus))
                {
                    SpellDefinition definition = spellStatus.definition;
                    if (!(null != definition))
                    {
                        yield break;
                    }
                    yield return(definition.LoadResources());

                    ICastTargetDefinition castTarget        = definition.castTarget;
                    CastTargetContext     castTargetContext = castTarget.CreateCastTargetContext(fightStatus, concernedEntity, DynamicValueHolderType.Spell, spellDefId, spellLevel, 0);
                    int count = targets.Count;
                    for (int j = 0; j < count; j++)
                    {
                        castTargetContext.SelectTarget(targets[j].ToTarget(fightStatus));
                    }
                    if (count > 0 && !playerStatus.isLocalPlayer)
                    {
                        CellObject targetedCell = GetTargetedCell(fightStatus, targets[0]);
                        yield return(FightUIRework.ShowPlayingSpell(spellStatus, targetedCell));
                    }
                    List <SpellEffectInstantiationData> spellEffectData = (List <SpellEffectInstantiationData>)definition.spellEffectData;
                    int spellEffectCount = spellEffectData.Count;
                    if (spellEffectCount > 0)
                    {
                        List <IEnumerator> routineList = ListPool <IEnumerator> .Get();

                        int num;
                        for (int i = 0; i < spellEffectCount; i = num)
                        {
                            SpellEffect spellEffect = definition.GetSpellEffect(i);
                            if (!(null == spellEffect))
                            {
                                SpellEffectInstantiationData spellEffectInstantiationData = spellEffectData[i];
                                spellEffectInstantiationData.PreComputeDelayOverDistance(castTargetContext);
                                foreach (Vector2Int item3 in spellEffectInstantiationData.EnumerateInstantiationPositions(castTargetContext))
                                {
                                    IEnumerator item = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item3, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item);
                                }
                                foreach (IsoObject item4 in spellEffectInstantiationData.EnumerateInstantiationObjectTargets(castTargetContext))
                                {
                                    IEnumerator item2 = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item4, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item2);
                                }
                                yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(routineList.ToArray()));

                                routineList.Clear();
                            }
                            num = i + 1;
                        }
                        ListPool <IEnumerator> .Release(routineList);
                    }
                    FightSpellEffectFactory.SetupSpellEffectOverrides(definition, fightStatus.fightId, eventId);
                }
                else
                {
                    Log.Error($"Could not find spell with instance id {spellInstanceId} for player with id {concernedEntity}.", 128, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 133, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
            }
        }
Ejemplo n.º 29
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);
        }
Ejemplo n.º 30
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            Direction direction = Direction.SouthEast;

            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                IsoObject view = entityStatus.view;
                if (null != view)
                {
                    ICharacterObject characterObject;
                    if ((characterObject = (view as ICharacterObject)) != null)
                    {
                        direction = characterObject.direction;
                    }
                    view.DetachFromCell();
                    view.Destroy();
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 97, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 102, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
            }
            if (fightStatus.TryGetEntity(newEntityId, out IEntityWithBoardPresence entityStatus2))
            {
                if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus3))
                {
                    EntityType newEntityType = (EntityType)this.newEntityType;
                    switch (newEntityType)
                    {
                    case EntityType.Hero:
                        throw new Exception("[TransformationEvent] Heroes cannot be transformed.");

                    case EntityType.Companion:
                        yield return(CompanionAddedEvent.CreateCompanionCharacterObject(fightStatus, (CompanionStatus)entityStatus2, entityStatus3, refCoord.X, refCoord.Y, direction));

                        break;

                    case EntityType.Summoning:
                        yield return(SummoningAddedEvent.CreateSummoningCharacterObject(fightStatus, (SummoningStatus)entityStatus2, entityStatus3, refCoord.X, refCoord.Y, direction));

                        break;

                    case EntityType.FloorMechanism:
                        yield return(FloorMechanismAddedEvent.CreateFloorMechanismObject(fightStatus, (FloorMechanismStatus)entityStatus2, entityStatus3, refCoord.X, refCoord.Y));

                        break;

                    case EntityType.ObjectMechanism:
                        yield return(ObjectMechanismAddedEvent.CreateObjectMechanismObject(fightStatus, (ObjectMechanismStatus)entityStatus2, entityStatus3, refCoord.X, refCoord.Y));

                        break;

                    case EntityType.Global:
                    case EntityType.Player:
                    case EntityType.Team:
                        Log.Error($"Transformation not handled for type {newEntityType}.", 134, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.PlayerNotFound(ownerId), 143, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(newEntityId), 148, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }