Beispiel #1
0
        public void OnEnemyDeath(NebulaObject enemy)
        {
            logger.Info($"{LOG_TAG}: enemy was killed {enemy.getItemType()}=>{enemy.Id}");

            if (enemy.getItemType() == ItemType.Bot)
            {
                var botComponent = enemy.GetComponent <BotObject>();
                if (botComponent?.getSubType() == BotItemSubType.StandardCombatNpc)
                {
                    var enemyCharacterObject = enemy.GetComponent <CharacterObject>();
                    if (enemyCharacterObject != null)
                    {
                        Workshop eClass        = (Workshop)enemyCharacterObject.workshop;
                        int      eLevel        = enemyCharacterObject.level;
                        var      shipComponent = enemy.GetComponent <BotShip>();
                        if (shipComponent != null)
                        {
                            ObjectColor eColor = NebulaEnumUtils.GetColorForDifficulty(shipComponent.difficulty);
                            KilledNpc = new QuestKilledNpc(eLevel, eClass, eColor, botComponent.botGroup);
                            TryCompleteQuest(sendUpdate: true);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// When enemy death we are send chat message to all player about this event if
        /// 1) enemy is orange NPC
        /// 2) i kill other player
        /// </summary>
        /// <param name="enemy">Enemy who was killed</param>
        public void OnEnemyDeath(NebulaObject enemy)
        {
            try {
                //log.InfoFormat(string.Format("PlayerCharacter:OnEnemyDeath()->{0}", enemy.Id));

                switch (enemy.getItemType())
                {
                case ItemType.Bot: {
                    BotObject botObject = enemy.GetComponent <BotObject>();
                    if (botObject != null)
                    {
                        switch (botObject.getSubType())
                        {
                        case BotItemSubType.Drill:
                        case BotItemSubType.Outpost:
                        case BotItemSubType.MainOutpost: {
                            mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillStandardNPCMessage(this, enemy));
                            break;
                        }

                        case BotItemSubType.StandardCombatNpc: {
                            ShipWeapon enemyWeapon = enemy.GetComponent <ShipWeapon>();
                            BotShip    enemyShip   = enemy.GetComponent <BotShip>();

                            if (enemyWeapon != null && enemyShip != null)
                            {
                                if (enemyWeapon.weaponDifficulty == Difficulty.boss || enemyWeapon.weaponDifficulty == Difficulty.boss2 ||
                                    enemyShip.difficulty == Difficulty.boss || enemyShip.difficulty == Difficulty.boss2)
                                {
                                    mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillStandardNPCMessage(this, enemy));
                                }
                            }
                        }
                        break;
                        }
                    }
                }
                break;

                case ItemType.Avatar: {
                    mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillOtherPlayerMessage(this, enemy));
                }
                break;
                }
            } catch (System.Exception exception) {
                log.InfoFormat("PlayerCharacter.OnEnemyDeath() exception: {0}", exception.Message);
                log.InfoFormat(exception.StackTrace);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Sended to my object fron enemy, when my object first start attacking enemy
 /// </summary>
 /// <param name="enemy">Attacking object</param>
 public void OnStartAttack(NebulaObject enemy)
 {
     switch (enemy.getItemType())
     {
     case ItemType.Bot: {
         BotObject botObject = enemy.GetComponent <BotObject>();
         if (botObject != null)
         {
             switch (botObject.getSubType())
             {
             case BotItemSubType.Drill:
             case BotItemSubType.Outpost:
             case BotItemSubType.MainOutpost:
                 mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetStartAttackMessage(this, enemy));
                 break;
             }
         }
     }
     break;
     }
 }