Aura.Channel.World.Entities.NPC.GetFavor C# (CSharp) Method

GetFavor() public method

Returns favor of the NPC towards the other creature.
public GetFavor ( Creature other ) : int
other Creature
return int
		public int GetFavor(Creature other)
		{
			// Get NPC favor and last change date
			var favor = other.Vars.Perm["npc_favor_" + this.Name] ?? 0;
			var change = other.Vars.Perm["npc_favor_change_" + this.Name];

			// Reduce favor by 1 each hour
			if (change != null && favor > 0)
			{
				TimeSpan diff = DateTime.Now - change;
				favor = Math.Max(0, favor - Math.Floor(diff.TotalHours));
			}

			return (int)favor;
		}