Exemple #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;
        }
 public void Initialize()
 {
     if (myInitialized)
     {
         return;
     }
     try
     {
         BHI = new Dictionary <int, List <BidHouseItem> >();
         if (!BidHouseTable.BHITEMS.ContainsKey(this.Guid))
         {
             BidHouseTable.BHITEMS.Add(Guid, new Dictionary <int, List <BidHouseItem> >());
         }
         BHI = BidHouseTable.BHITEMS[Guid];
         foreach (String s in Friends.Split(';'))
         {
             if (String.IsNullOrEmpty(s))
             {
                 continue;
             }
             FriendsList.Add(Convert.ToInt32(s.Split('|')[0]), s.Split('|')[1]);
         }
         foreach (String s in Ennemys.Split(';'))
         {
             if (String.IsNullOrEmpty(s))
             {
                 continue;
             }
             EnnemyList.Add(Convert.ToInt32(s.Split('|')[0]), s.Split('|')[1]);
         }
         foreach (String s in Bank.Split(';'))
         {
             if (String.IsNullOrEmpty(s))
             {
                 continue;
             }
             long id;
             if (!long.TryParse(s, out id))
             {
                 continue;
             }
             InventoryItemModel obj = InventoryItemTable.getItem(id);
             if (obj != null)
             {
                 bankItems.Add(id, obj);
             }
             else
             {
                 obj = InventoryItemTable.Load(id);
                 if (obj != null)
                 {
                     bankItems.Add(id, obj);
                 }
             }
         }
         foreach (String s in Stables.Split(';'))
         {
             if (String.IsNullOrEmpty(s))
             {
                 continue;
             }
             int id;
             if (!int.TryParse(s, out id))
             {
                 continue;
             }
             Mount DD = MountTable.getMount(id);
             if (DD != null)
             {
                 Mounts.Add(id, DD);
             }
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
     myInitialized = true;
 }