private static int GetCostIfBuying(CharacterInstance ch, MobileInstance keeper, ObjectInstance obj) { var richCustomer = ch.CurrentCoin > ch.Level * ch.Level * 100000; var profitMod = 13 - ch.GetCurrentCharisma() + (richCustomer ? 15 : 0) + (ch.Level.GetNumberThatIsBetween(5, LevelConstants.AvatarLevel) - 20) / 2; var shop = keeper.MobIndex.Shop.CastAs <ItemShopData>(); var cost = obj.Cost * (shop.ProfitSell + 1).GetHighestOfTwoNumbers(shop.ProfitBuy + profitMod) / 100; return(cost); }
private static int GetCostIfSelling(CharacterInstance ch, MobileInstance keeper, ObjectInstance obj) { var richCustomer = ch.CurrentCoin > ch.Level * ch.Level * 100000; var profitMod = 13 - ch.GetCurrentCharisma() + (richCustomer ? 15 : 0); var shop = keeper.MobIndex.Shop.CastAs <ItemShopData>(); var cost = 0; if (shop.ItemTypes.ToList().Contains(obj.ItemType)) { cost = obj.Cost * (shop.ProfitBuy - 1).GetLowestOfTwoNumbers(shop.ProfitSell + profitMod) / 100; } if (keeper.Carrying.Any(carriedObj => obj.ObjectIndex == carriedObj.ObjectIndex)) { cost = 0; } return(cost); }