Ejemplo n.º 1
0
        public override void Init(World owner)
        {
            MaxHackEntries = 0;
            visibleTiles   = new Dictionary <IntPoint, bool>();
            WorldInstance  = owner;

            var rand = new Random();

            int x, y;

            do
            {
                x = rand.Next(0, owner.Map.Width);
                y = rand.Next(0, owner.Map.Height);
            } while (owner.Map[x, y].Region != TileRegion.Spawn);

            var newposition = owner.RemovePositionFromReconnect(AccountId);

            if (newposition.Item1 != 0 && newposition.Item2 != 0)
            {
                Move((int)newposition.Item1 + 0.5f, (int)newposition.Item2 + 0.5f);
            }
            else
            {
                Move(x + 0.5f, y + 0.5f);
            }

            tiles = new byte[owner.Map.Width, owner.Map.Height];

            SetNewbiePeriod();

            base.Init(owner);

            var gifts = Client.Account.Gifts.ToList();

            if (owner.Id == (int)WorldID.NEXUS_ID || owner.Name == "Vault")
            {
                Client.SendMessage(new GLOBAL_NOTIFICATION
                {
                    Type = 0,
                    Text = gifts.Count > 0 ? "giftChestOccupied" : "giftChestEmpty"
                });
            }

            if (Client.Character.Pet != 0)
            {
                HatchlingPet          = false;
                HatchlingNotification = false;
                Pet = Resolve((ushort)PetID);
                Pet.Move(x, y);
                Pet.SetPlayerOwner(this);
                Owner.EnterWorld(Pet);
                Pet.IsPet = true;
            }

            SendAccountList(Locked, ACCOUNTLIST.LOCKED_LIST_ID);
            SendAccountList(Ignored, ACCOUNTLIST.IGNORED_LIST_ID);

            CheckSetTypeSkin();

            if (Settings.SERVER_MODE == Settings.ServerMode.Local)
            {
                if ((AccountType)AccountType == Core.config.AccountType.ADMIN)
                {
                    ApplyConditionEffect((ConditionEffect) new ConditionEffect
                    {
                        Effect     = ConditionEffectIndex.Invulnerable,
                        DurationMS = -1
                    });
                }
            }

            ApplyConditionEffect(AccountPerks.SetAccountTypeIcon());

            Achievements  = ImportAchivementCache();
            ActualTask    = ImportTaskCache();
            MonsterCaches = ImportMonsterCaches();

            if (ActualTask != null)
            {
                Task = GameTask.Tasks[ActualTask];
            }

            if (Client.Account.Credits < 0)
            {
                SendInfo("[Patch: negative currency] Gold set to 0.");
                GameServer.Manager.Database.UpdateCredit(Client.Account, Math.Abs(Client.Account.Credits));
            }

            if (Client.Account.Fame < 0)
            {
                SendInfo("[Patch: negative currency] Fame set to 0.");
                GameServer.Manager.Database.UpdateFame(Client.Account, Math.Abs(Client.Account.Fame));
            }
        }
Ejemplo n.º 2
0
        public override void Init(World owner)
        {
            MaxHackEntries = 0;
            visibleTiles   = new Dictionary <IntPoint, bool>();
            WorldInstance  = owner;
            Random rand = new Random();
            int    x, y;

            do
            {
                x = rand.Next(0, owner.Map.Width);
                y = rand.Next(0, owner.Map.Height);
            } while (owner.Map[x, y].Region != TileRegion.Spawn);
            Move(x + 0.5f, y + 0.5f);
            tiles = new byte[owner.Map.Width, owner.Map.Height];
            SetNewbiePeriod();
            base.Init(owner);
            List <int> gifts = Client.Account.Gifts.ToList();

            if (owner.Id == (int)WorldID.NEXUS_ID || owner.Name == "Vault")
            {
                Client.SendMessage(new GLOBAL_NOTIFICATION
                {
                    Type = 0,
                    Text = gifts.Count > 0 ? "giftChestOccupied" : "giftChestEmpty"
                });
            }
            if (Client.Character.Pet != 0)
            {
                HatchlingPet          = false;
                HatchlingNotification = false;
                Pet = Resolve((ushort)PetID);
                Pet.Move(x, y);
                Pet.SetPlayerOwner(this);
                Owner.EnterWorld(Pet);
                Pet.IsPet = true;
            }

            SendAccountList(Locked, ACCOUNTLIST.LOCKED_LIST_ID);
            SendAccountList(Ignored, ACCOUNTLIST.IGNORED_LIST_ID);

            CheckSetTypeSkin();

            if ((AccountType)AccountType == Core.config.AccountType.LOESOFT_ACCOUNT)
            {
                ConditionEffect invincible = new ConditionEffect
                {
                    Effect     = ConditionEffectIndex.Invincible,
                    DurationMS = -1
                };

                ApplyConditionEffect(invincible);

                ConditionEffect invulnerable = new ConditionEffect
                {
                    Effect     = ConditionEffectIndex.Invulnerable,
                    DurationMS = -1
                };

                ApplyConditionEffect(invulnerable);
            }

            ApplyConditionEffect(AccountPerks.SetAccountTypeIcon());

            Achievements  = ImportAchivementCache();
            ActualTask    = ImportTaskCache();
            MonsterCaches = ImportMonsterCaches();

            if (ActualTask != null)
            {
                Task = GameTask.Tasks[ActualTask];
            }
        }