public static int GetWealthMultiplierInt(CLRScriptBase script, uint Character, bool CombatDrop)
{
if (script.GetIsPC(Character) == CLRScriptBase.FALSE) return 0;
int lootValue = GetTotalValueOfKit(script, Character);
int level = GetEffectiveLevel(script, Character);
int retVal = 4000; // very poor level 20. No multiplier should be more than this.
if (recentlyDroppedItems.ContainsKey(Character))
{
List<uint> checkedPCs = new List<uint>();
List<uint> removedItems = new List<uint>();
checkedPCs.Add(Character); // We already checked the PC outside of this loop.
uint partyMate = script.GetFirstFactionMember(Character, CLRScriptBase.TRUE);
while (script.GetIsObjectValid(partyMate) == CLRScriptBase.TRUE)
{
if(!checkedPCs.Contains(partyMate))
{
checkedPCs.Add(partyMate);
int tempMult = WealthToMultiplier(GetTotalValueOfKit(script, partyMate), GetEffectiveLevel(script, partyMate), CombatDrop);
if (tempMult < retVal) retVal = tempMult;
}
partyMate = script.GetNextFactionMember(Character, CLRScriptBase.TRUE);
}
foreach (uint Item in recentlyDroppedItems[Character])
{
if (script.GetIsObjectValid(Item) == CLRScriptBase.TRUE)
{
if(!checkedPCs.Contains(script.GetItemPossessor(Item)))
{
uint itemOwner = script.GetItemPossessor(Item);
if (script.GetIsObjectValid(itemOwner) != CLRScriptBase.FALSE)
{
// Remember that this might be OBJECT_INVALID, if it's just on the
// ground.
checkedPCs.Add(itemOwner);
}
if(script.GetIsPC(itemOwner) != CLRScriptBase.FALSE)
{
int tempMult = WealthToMultiplier(GetTotalValueOfKit(script, itemOwner), GetEffectiveLevel(script, itemOwner), CombatDrop);
if (tempMult < retVal) retVal = tempMult;
}
else if(script.GetObjectType(itemOwner) != CLRScriptBase.OBJECT_TYPE_STORE)
{
lootValue += script.GetGoldPieceValue(Item);
}
}
}
else
{
removedItems.Add(Item);
}
}
foreach(uint Item in removedItems)
{
recentlyDroppedItems[Character].Remove(Item);
}
}
int chaMult = WealthToMultiplier(lootValue, level, CombatDrop);
if (chaMult < retVal) retVal = chaMult;
return retVal;
}