コード例 #1
0
 /// <summary>
 /// add the item to the first free slot
 /// </summary>
 /// <returns>Item template or null</returns>
 public virtual void AddFirstFreeSlot(HookPointItem item)
 {
     if (hookpointItemList.Count < 10)
     {
         hookpointItemList.Add(item);
     }
     else if (log.IsErrorEnabled)
     {
         log.Error("inventory is full");
     }
 }
コード例 #2
0
 /// <summary>
 /// add the item to the slot
 /// </summary>
 /// <param name="item"></param>
 /// <param name="slot">The item slot</param>
 /// <returns>Item template or null</returns>
 public virtual void AddItem(HookPointItem item, int slot)
 {
     if (hookpointItemList[slot] != null)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("item add to slot already used");
         }
         return;
     }
     if ((slot > MAX_ITEM) || (slot < 0))
     {
         if (log.IsErrorEnabled)
         {
             log.Error("slot out of the inventory");
         }
         return;
     }
     hookpointItemList[slot] = item;
 }
コード例 #3
0
        protected virtual void LoadHookPoints()
        {
            if (!ServerProperties.Properties.LOAD_KEEPS || !ServerProperties.Properties.LOAD_HOOKPOINTS)
            {
                return;
            }

            Dictionary <string, List <DBKeepHookPoint> > hookPointList = new Dictionary <string, List <DBKeepHookPoint> >();

            var dbkeepHookPoints = GameServer.Database.SelectAllObjects <DBKeepHookPoint>();

            foreach (DBKeepHookPoint dbhookPoint in dbkeepHookPoints)
            {
                List <DBKeepHookPoint> currentArray;
                string key = dbhookPoint.KeepComponentSkinID + "H:" + dbhookPoint.Height;
                if (!hookPointList.ContainsKey(key))
                {
                    hookPointList.Add(key, currentArray = new List <DBKeepHookPoint>());
                }
                else
                {
                    currentArray = hookPointList[key];
                }
                currentArray.Add(dbhookPoint);
            }
            foreach (AbstractGameKeep keep in m_keepList.Values)
            {
                foreach (GameKeepComponent component in keep.KeepComponents)
                {
                    string key = component.Skin + "H:" + component.Height;
                    if ((hookPointList.ContainsKey(key)))
                    {
                        List <DBKeepHookPoint> HPlist = hookPointList[key];
                        if ((HPlist != null) && (HPlist.Count != 0))
                        {
                            foreach (DBKeepHookPoint dbhookPoint in hookPointList[key])
                            {
                                GameKeepHookPoint myhookPoint = new GameKeepHookPoint(dbhookPoint, component);
                                component.HookPoints.Add(dbhookPoint.HookPointID, myhookPoint);
                            }
                            continue;
                        }
                    }
                    //add this to keep hookpoint system until DB is not full
                    for (int i = 0; i < 38; i++)
                    {
                        component.HookPoints.Add(i, new GameKeepHookPoint(i, component));
                    }

                    component.HookPoints.Add(65, new GameKeepHookPoint(0x41, component));
                    component.HookPoints.Add(97, new GameKeepHookPoint(0x61, component));
                    component.HookPoints.Add(129, new GameKeepHookPoint(0x81, component));
                }
            }

            log.Info("Loading HookPoint items");

            //fill existing hookpoints with objects
            IList <DBKeepHookPointItem> items = GameServer.Database.SelectAllObjects <DBKeepHookPointItem>();

            foreach (AbstractGameKeep keep in m_keepList.Values)
            {
                foreach (var component in keep.KeepComponents)
                {
                    foreach (var hp in component.HookPoints.Values)
                    {
                        var item = items.FirstOrDefault(
                            it => it.KeepID == component.Keep.KeepID && it.ComponentID == component.ID && it.HookPointID == hp.ID);
                        if (item != null)
                        {
                            HookPointItem.Invoke(component.HookPoints[hp.ID], item.ClassType);
                        }
                    }
                }
            }
        }
コード例 #4
0
		/// <summary>
		/// add the item to the first free slot
		/// </summary>
		/// <returns>Item template or null</returns>
		public virtual void AddFirstFreeSlot(HookPointItem item)
		{
			if (hookpointItemList.Count < 10)
				hookpointItemList.Add(item);

			else if (log.IsErrorEnabled)
				log.Error("inventory is full");
		}
コード例 #5
0
		/// <summary>
		/// add the item to the slot
		/// </summary>
		/// <param name="item"></param>
		/// <param name="slot">The item slot</param>
		/// <returns>Item template or null</returns>
		public virtual void AddItem(HookPointItem item, int slot)
		{
			if (hookpointItemList[slot] != null)
			{
				if (log.IsErrorEnabled)
					log.Error("item add to slot already used");
				return;
			}
			if ((slot > MAX_ITEM) || (slot < 0))
			{
				if (log.IsErrorEnabled)
					log.Error("slot out of the inventory");
				return;
			}
			hookpointItemList[slot] = item;
		}