Exemplo n.º 1
0
                public async Task RecipeStat(Recipe recipe, Stat stat, int count)
                {
                    Player player = GetPlayer();

                    StatCount found = recipe.requiredStatCount.FirstOrDefault(test => test.stat == stat);

                    if (found != null)
                    {
                        if (count == 0)
                        {
                            recipe.requiredStatCount.Remove(found);
                            await ReplyAsync(recipe.name + " no longer expects : " + stat.name);

                            return;
                        }

                        found.count = count;
                    }
                    else
                    {
                        recipe.requiredStatCount.Add(new StatCount()
                        {
                            stat = stat, count = count
                        });
                    }

                    await ReplyAsync(recipe.name + " now expects: " + stat.name + " >= " + count);
                }
Exemplo n.º 2
0
			public void Update()
			{
				shared = modified;
				right = 0;
				left = 0;

				foreach (KeyValuePair<Slot, ItemCount> equipment in unit.equipped)
				{
					if (equipment.Value != null)
					{
						StatCount modification = equipment.Value.item.statModifications.FirstOrDefault(test => test.stat == stat);

						if (modification != null)
						{
							if (equipment.Key.side == 0 || !stat.isHandDependant)
							{
								shared += modification.count;
							}
							else if (equipment.Key.side == 1)
							{
								right = modification.count;
							}
							else
							{
								left = modification.count;
							}
						}
					}
				}
			}
Exemplo n.º 3
0
		public StatGroup GetStat(Stat stat)
		{
			StatGroup result = new StatGroup();

			result.unit = this;
			result.stat = stat;

			StatCount defaultValue = ChatCraft.Instance.State.settings.defaultStats.FirstOrDefault(test => test.stat == stat);

			if (defaultValue != null)
			{
				result.baseValue = result.modified = defaultValue.count;
			}

			StatCount modified = modifiedBaseStats.FirstOrDefault(test => test.stat == stat);

			if (modified != null)
			{
				result.modified = modified.count;
			}

			result.Update();

			return result;
		}
Exemplo n.º 4
0
			public void Modify(int add)
			{
				StatCount modified = unit.modifiedBaseStats.FirstOrDefault(test => test.stat == stat);

				if (modified == null)
				{
					modified = new StatCount()
					{
						stat = stat,
						count = this.modified
					};

					unit.modifiedBaseStats.Add(modified);
				}

				modified.count += add;
				this.modified = modified.count;

				Update();
			}
Exemplo n.º 5
0
			public void SetModified(int setTo)
			{
				StatCount modified = unit.modifiedBaseStats.FirstOrDefault(test => test.stat == stat);

				if (modified == null)
				{
					modified = new StatCount()
					{
						stat = stat,
						count = setTo
					};

					unit.modifiedBaseStats.Add(modified);

					return;
				}

				modified.count = setTo;
				this.modified = modified.count;

				Update();
			}
Exemplo n.º 6
0
                public async Task ItemStat(string itemName, string statName, int value)
                {
                    Player player = GetPlayer();

                    Item item = ChatCraft.Instance.State.items.FirstOrDefault(test => test.name.ToLower() == itemName.ToLower());

                    if (item == null)
                    {
                        await ReplyAsync("There is no item called " + itemName);

                        return;
                    }

                    Stat stat = ChatCraft.Instance.State.stats.FirstOrDefault(test => test.name == statName);

                    if (stat == null)
                    {
                        await ReplyAsync("There is no stat called " + statName);

                        return;
                    }

                    StatCount count = item.statModifications.FirstOrDefault(test => test.stat == stat);

                    if (count == null)
                    {
                        count = new StatCount()
                        {
                            stat = stat
                        };

                        item.statModifications.Add(count);
                    }

                    count.count = value;

                    await ReplyAsync("Item modified: " + itemName);
                }