Esempio n. 1
0
        public void toogleOnMount()
        {
            if ((Program.currentTimeMillis() - lastMountRide) < 2000)
            {
                return;
            }
            onMount = !onMount;

            InventoryItemModel obj = this.InventoryCache.GetItemInSlot(ItemSlotEnum.SLOT_FAMILIER);


            if (onMount && obj != null)
            {
                obj.Position = (int)ItemSlotEnum.SLOT_INVENTAIRE;
                Client.Send(new ObjectMoveSucessMessage(obj.ID, (short)obj.Position));
                this.myStats.UnMerge(obj.GetStats());
                this.Life -= obj.GetStats().GetTotal(EffectEnum.AddVitalite);
            }

            if (Mount.Energy <= 0)
            {
                Mount.Energy = 0;
                return;
            }

            if (Client.GetFight() != null && Client.GetFight().FightState == FightState.STATE_PLACE)
            {
                Client.GetFight().SendToFight(new CharacterFighterMount(Client.GetFighter(), this.ID));
            }
            else
            {
                this.RefreshOnMap();
            }

            if (onMount)
            {
                this.myStats.Merge(Mount.GetStats());
                this.Life += Mount.GetStats().GetTotal(EffectEnum.AddVitalite);
            }
            else
            {
                this.myStats.UnMerge(Mount.GetStats());
                this.Life -= Mount.GetStats().GetTotal(EffectEnum.AddVitalite);
            }

            Client.Send(new CharacterRideEventMessage("+", Mount));

            Client.Send(new CharacterRideMessage(onMount ? "+" : "-"));
            Client.Send(new AccountStatsMessage(this));
            Mount.Energy -= 10;
            lastMountRide = Program.currentTimeMillis();
        }
Esempio n. 2
0
        public void Intialize()
        {
            if (myIntialized)
            {
                return;
            }

            foreach (String str in ItemList.Split(';'))
            {
                try
                {
                    if (String.IsNullOrEmpty(str))
                    {
                        continue;
                    }
                    long idd;
                    if (!long.TryParse(str, out idd))
                    {
                        continue;
                    }
                    InventoryItemModel obj = InventoryItemTable.getItem(idd);
                    if (obj != null)
                    {
                        Items.Add(obj.ID, obj);
                    }
                    else
                    {
                        obj = InventoryItemTable.Load(idd);
                        if (obj != null)
                        {
                            Items.Add(obj.ID, obj);
                        }
                    }
                }
                catch (Exception e) { continue; }
            }


            myIntialized = true;
        }
Esempio n. 3
0
 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;
 }