Trying to figure out how to add compassion gain to this:

Code:
if (DateTime.Now < m_LastClicked + TimeSpan.FromHours(1.0))

{

from.SendLocalizedMessage(1060001);//You throw the switch, but the mechanism cannot be engaged again so soon.

return;

}



Container pack = from.Backpack as Container;

if (pack == null)

return;

{

Item PlagueBeastMutationCore = from.Backpack.FindItemByType(typeof(PlagueBeastMutationCore));

Item Obsidian = from.Backpack.FindItemByType(typeof(Obsidian));

Item MoonfireBrew = from.Backpack.FindItemByType(typeof(MoonfireBrew));

if (PlagueBeastMutationCore != null && Obsidian != null && MoonfireBrew != null)

{

from.PlaySound(0x21E);

from.SendLocalizedMessage(1055143);//You add the required ingredients and activate the contraption. It rumbles and smokes and then falls silent. The water shines for a brief moment, and you feel confident that it is now much less tainted then before.

from.Karma += 500; //On OSI completion awards one dot in the Compassion Virtue

PlagueBeastMutationCore.Delete();

Obsidian.Delete();

MoonfireBrew.Delete();

LastClicked = DateTime.Now;

return;

}

else

{

from.SendLocalizedMessage(1055142);//You do not have the necessary ingredients. The contraptions rumbles angrily but does nothing.

}

}

}

}

}



compassion section from baseescortable.cs

bool gainedPath = false;

PlayerMobile pm = escorter as PlayerMobile;

if (pm != null)

{

if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay)

{

pm.NextCompassionDay = DateTime.MinValue;

pm.CompassionGains = 0;

}

if (pm.CompassionGains >= 5) // have already gained 5 times in one day, can gain no more

{

pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again.

}

else if (VirtueHelper.Award(pm, VirtueName.Compassion, this.IsPrisoner ? 400 : 200, ref gainedPath))

{

if (gainedPath)

pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion!

else

pm.SendLocalizedMessage(1053002); // You have gained in compassion.

pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0

++pm.CompassionGains;


}

else

{

pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further.

}


}

return true;

}

return false;

}
 
Last edited:
Back