public string GetKillOtherPlayerMessage(PlayerCharacterObject player, NebulaObject enemy)
        {
            MmoWorld       world          = player.nebulaObject.mmoWorld();
            RaceableObject playerRaceable = player.GetComponent <RaceableObject>();

            PlayerCharacterObject enemyCharacter = enemy.GetComponent <PlayerCharacterObject>();
            RaceableObject        enemyRaceable  = enemy.GetComponent <RaceableObject>();

            string systemName     = world.Resource().Zones.GetZoneName(world.Name);
            string playerName     = player.characterName;
            string playerRaceName = world.Resource().Zones.GetRaceName(playerRaceable.getRace());

            string sourceCoalitionName = player.guildName;

            if (sourceCoalitionName == null)
            {
                sourceCoalitionName = string.Empty;
            }

            string enemyName     = enemyCharacter.characterName;
            string enemyRaceName = world.Resource().Zones.GetRaceName(enemyRaceable.getRace());

            string enemyCoalitionName = enemyCharacter.guildName;

            if (enemyCoalitionName == null)
            {
                enemyCoalitionName = string.Empty;
            }

            return(string.Format("scm11:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enrace={5};encoal={6}",
                                 world.Name, playerName, playerRaceable.race, sourceCoalitionName,
                                 enemyName, enemyRaceable.race, enemyCoalitionName));
        }
Example #2
0
        public void Load()
        {
            if (!IsLoaded)
            {
                bool isNewSave = false;
                PlayerCharacterObject playerCharacter = GetComponent <PlayerCharacterObject>();
                GameApplication       application     = nebulaObject.mmoWorld().application;
                QuestSave             questSave       = QuestDatabase.instance(application).LoadQuests(playerCharacter.characterId, out isNewSave);

                completedQuests.Clear();
                foreach (string cQuest in questSave.CompletedQuests)
                {
                    completedQuests.Add(cQuest);
                }

                startedQuests.Clear();
                foreach (Hashtable sQuest in questSave.StartedQuests)
                {
                    QuestInfo questInfo = new QuestInfo(this);
                    questInfo.ParseInfo(sQuest);
                    if (questInfo.IsValid)
                    {
                        startedQuests.Add(questInfo);
                    }
                }

                questVariables.Clear();
                foreach (DictionaryEntry entry in questSave.QuestVariables)
                {
                    questVariables.TryAdd(entry.Key.ToString(), entry.Value);
                }

                IsLoaded = true;
            }
        }
Example #3
0
        public void Load()
        {
            Start();

            log.InfoFormat("MmoActor Load() [dy]");

            if (mCharacter == null)
            {
                mCharacter = GetComponent <PlayerCharacterObject>();
            }
            if (mCharacter != null && mCharacter.characterId == null)
            {
                mCharacter.SetCharacterId((string)nebulaObject.Tag((byte)PlayerTags.CharacterId));
            }

            bool isNew = false;

            try {
                PlayerCharacter dbCharacter = CharacterDatabase.instance(application).LoadCharacter(mCharacter.characterId, resource as Res, out isNew);

                if (!isNew)
                {
                    SetPlayerCharacter(dbCharacter);
                }
                else
                {
                    this.name = (string)nebulaObject.Tag((byte)PlayerTags.Name);
                    GetComponent <PlayerCharacterObject>().SetExp(0);
                    GetComponent <PlayerShip>().SetStartModel((Hashtable)nebulaObject.Tag((byte)PlayerTags.Model));
                    GetComponent <PlayerCharacterObject>().SetWorkshop((byte)(int)nebulaObject.Tag((byte)PlayerTags.Workshop));
                    GetComponent <RaceableObject>().SetRace((byte)(int)nebulaObject.Tag((byte)PlayerTags.Race));
                    GetComponent <PlayerCharacterObject>().SetLogin((string)nebulaObject.Tag((byte)PlayerTags.Login));

                    CharacterDatabase.instance(application).SaveCharacter(mCharacter.characterId, GetPlayerCharacter());
                }

                switch ((Race)(byte)(int)nebulaObject.Tag((byte)PlayerTags.Race))
                {
                case Race.Humans:
                    GetComponent <PlayerCharacterObject>().SetFraction(FractionType.PlayerHumans);
                    break;

                case Race.Borguzands:
                    GetComponent <PlayerCharacterObject>().SetFraction(FractionType.PlayerBorguzands);
                    break;

                case Race.Criptizoids:
                    GetComponent <PlayerCharacterObject>().SetFraction(FractionType.PlayerCriptizids);
                    break;
                }
            } catch (Exception ex) {
                log.InfoFormat("handled exception");
                log.InfoFormat(ex.Message);
                log.InfoFormat(ex.StackTrace);
            }
        }
Example #4
0
 public void Load()
 {
     Start();
     if (m_Character == null) {
         m_Character = GetComponent<PlayerCharacterObject>();
     }
     bool isNew = false;
     m_PetInfoCollection = PetDatabase.instance(nebulaObject.mmoWorld().application).LoadPets(m_Character.characterId, nebulaObject.resource as Res, out isNew);
     Reinitialize();
 }
Example #5
0
 public override void Start()
 {
     if (!m_StartCalled) {
         m_StartCalled = true;
         base.Start();
         m_Character = GetComponent<PlayerCharacterObject>();
         m_Player = GetComponent<MmoActor>();
         m_PlayerTarget = GetComponent<PlayerTarget>();
         m_Bonuses = GetComponent<PlayerBonuses>();
     }
 }
        public string GetStartAttackMessage(PlayerCharacterObject player, NebulaObject enemy)
        {
            MmoWorld        world          = player.nebulaObject.mmoWorld();
            RaceableObject  playerRaceable = player.GetComponent <RaceableObject>();
            CharacterObject enemyCharacter = enemy.GetComponent <CharacterObject>();
            BotObject       botObject      = enemy.GetComponent <BotObject>();

            string systemName = world.Resource().Zones.GetZoneName(world.Name);
            string playerName = player.characterName;
            //string playerRaceName = world.Resource().Zones.GetRaceName(playerRaceable.getRace());
            string npcName  = GenerateStandardNpcName(systemName, enemy.Id);
            int    npcLevel = enemyCharacter.level;

            string coalitionName = player.guildName;

            if (coalitionName == null)
            {
                coalitionName = string.Empty;
            }


            switch (botObject.getSubType())
            {
            case BotItemSubType.Drill:
                return(string.Format("scm4:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enlvl={5}",
                                     world.Name, playerName,
                                     playerRaceable.race, coalitionName,
                                     npcName, npcLevel));

            case BotItemSubType.Outpost:
                return(string.Format("scm5:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enlvl={5}",
                                     world.Name, playerName,
                                     playerRaceable.race, coalitionName,
                                     npcName, npcLevel));

            case BotItemSubType.MainOutpost:
                return(string.Format("scm6:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enlvl={5}",
                                     world.Name, playerName,
                                     playerRaceable.race, coalitionName,
                                     npcName, npcLevel));

            default:
                return(string.Empty);
            }
        }
        public string GetSetMiningStationMessage(PlayerCharacterObject player)
        {
            MmoWorld       world          = player.nebulaObject.mmoWorld();
            RaceableObject playerRaceable = player.GetComponent <RaceableObject>();
            string         playerName     = player.characterName;
            string         coalitionName  = player.guildName;

            if (coalitionName == null)
            {
                coalitionName = string.Empty;
            }


            return(string.Format("scm1:zone={0};chname={1};chrace={2};chcoal={3}",
                                 world.Name,
                                 playerName,
                                 playerRaceable.race,
                                 coalitionName
                                 ));
        }
Example #8
0
        public override void Start()
        {
            if (!m_StartCalled)
            {
                m_StartCalled   = true;
                mShip           = RequireComponent <PlayerShip>();
                mTarget         = RequireComponent <PlayerTarget>();
                mCharacter      = RequireComponent <PlayerCharacterObject>();
                mAI             = RequireComponent <AIState>();
                mRace           = RequireComponent <RaceableObject>();
                mMessage        = RequireComponent <MmoMessageComponent>();
                mDamagable      = RequireComponent <ShipBasedDamagableObject>();
                mWeapon         = RequireComponent <ShipWeapon>();
                mSkills         = RequireComponent <PlayerSkills>();
                mBonuses        = RequireComponent <PlayerBonuses>();
                mPassiveBonuses = GetComponent <PassiveBonusesComponent>();

                mCharacter.SetCharacterId((string)nebulaObject.Tag((byte)PlayerTags.CharacterId));
                mCharacter.SetCharacterName((string)nebulaObject.Tag((byte)PlayerTags.Name));
                printPropertiesTimer = printPropertiesInterval;

                if (application.serverActors.ContainsKey(nebulaObject.Id))
                {
                    MmoActor old;
                    if (application.serverActors.TryRemove(nebulaObject.Id, out old))
                    {
                        log.Info("successfully remove actor before replacing with new [red]");
                    }
                }
                if (application.serverActors.TryAdd(nebulaObject.Id, this))
                {
                    log.Info("successfully added actor to server actors [red]");
                }

                //create chest on killing when player die
                mDamagable.SetCreateChestOnKilling(true);
                mDamagable.SetIgnoreDamageInterval(30);
                mDamagable.SetIgnoreDamageAtStart(true);
            }
        }
        public string GetSetOutpostMessage(PlayerCharacterObject player)
        {
            MmoWorld       world          = player.nebulaObject.mmoWorld();
            RaceableObject playerRaceable = player.GetComponent <RaceableObject>();
            string         systemName     = world.Resource().Zones.GetZoneName(world.Name);
            string         playerName     = player.characterName;
            string         playerRaceName = world.Resource().Zones.GetRaceName(playerRaceable.getRace());
            string         coalitionName  = player.guildName;

            if (coalitionName == null)
            {
                coalitionName = string.Empty;
            }


            return(string.Format("scm3:zone={0};chname={1};chrace={2};chcoal={3}",
                                 systemName,
                                 playerName,
                                 playerRaceable.race,
                                 coalitionName
                                 ));
        }