private static void RunSearchCycle(NWPlayer oPC, NWPlaceable oChest, int iDC) { int lootTable = oChest.GetLocalInt(SearchSiteLootTableVariableName); int skill = _.GetSkillRank(_.SKILL_SEARCH, oPC.Object); if (skill > 10) { skill = 10; } else if (skill < 0) { skill = 0; } int roll = RandomService.Random(20) + 1; int combinedRoll = roll + skill; if (roll + skill >= iDC) { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *success*: (" + roll + " + " + skill + " = " + combinedRoll + " vs. DC: " + iDC + ")")); ItemVO spawnItem = PickResultItem(lootTable); if (!string.IsNullOrWhiteSpace(spawnItem.Resref) && spawnItem.Quantity > 0) { NWItem foundItem = (_.CreateItemOnObject(spawnItem.Resref, oChest.Object, spawnItem.Quantity, "")); float maxDurability = DurabilityService.GetMaxDurability(foundItem); if (maxDurability > -1) { DurabilityService.SetDurability(foundItem, RandomService.RandomFloat() * maxDurability + 1); } } } else { oPC.FloatingText(ColorTokenService.SkillCheck("Search: *failure*: (" + roll + " + " + skill + " = " + combinedRoll + " vs. DC: " + iDC + ")")); } }