Exemplo n.º 1
0
        private void Initialize()
        {
            this.myStats = new GenericStats(this);
            for (int i = 1; i < 16; i++)
            {
                var Item = this.InventoryCache.GetItemInSlot((ItemSlotEnum)i);

                if (Item != null)
                {
                    this.myStats.Merge(Item.GetStats());
                    this.Life += Item.GetStats().GetTotal(EffectEnum.AddVitalite);
                }
            }
            if (this.ZaapString != null)
            {
                foreach (String str in ZaapString.Split(','))
                {
                    short zaap;
                    if (!short.TryParse(str, out zaap))
                    {
                        continue;
                    }
                    try
                    {
                        Zaaps.Add(zaap);
                    }
                    catch (Exception e)
                    {
                        Logger.Error(e);
                    }
                }
            }
            else
            {
                if (Settings.AppSettings.GetBoolElement("World.AllZaap"))
                {
                    foreach (short map in ZaapTable.Cache.Keys)
                    {
                        this.Zaaps.Add(map);
                    }
                }
            }

            if (this.MountID != -1)
            {
                Mount = MountTable.getMount(this.MountID);
                if (Mount != null)
                {
                    Mount.Intialize();
                }
            }

            if (this.SpellString == null || this.SpellString == "")
            {
                this.mySpells = SpellBook.GenerateForBreed((ClassEnum)this.Classe);
                for (int i = 1; i < Client.GetCharacter().Level; i++)
                {
                    this.mySpells.GenerateLevelUpSpell((ClassEnum)Client.GetCharacter().Classe, i);
                }
                Client.Send(new BasicNoOperationMessage());
                Client.Send(new SpellsListMessage(Client.Character));
            }
            else
            {
                this.mySpells = SpellBook.FromDatabase(this.SpellString);
            }

            if (LifePer <= 0)
            {
                LifePer = 1;
            }

            Life = (MaxLife * LifePer / 100);
            if (Life == 0)
            {
                Life = 1;
            }
            _exPdv = Life;

            this.myInitialized = true;
        }