message: rarity index fix for egg crates
diff: @@ -138,7 +138,11 @@ static int getRarity(int crateId, int itemSetId) {
  relevantWeights.push_back(rarityWeights[index]);
  // now return a random rarity number (starting from 1)
  - return Rand::randWeighted(relevantWeights) + 1;
  + int rarityChoice = Rand::randWeighted(relevantWeights);
  +
  + auto it = rarityIndices.begin();
  + std::advance(it, rarityChoice);
  + return *it + 1;
  }
  static int getCrateItem(sItemBase* result, int itemSetId, int rarity, int playerGender) {
  @@ -562,18 +566,26 @@ static void chestOpenHandler(CNSocket *sock, CNPacketData *data) {
  int validCrateId = getValidCrateId(chest->iID);
  bool failing = (validCrateId == -1);
  + std::cout << "validCrateId " << validCrateId << std::endl;
  +
  if (!failing)
  validItemSetId = getValidItemSetId(validCrateId);
  failing = (validItemSetId == -1);
  + std::cout << "validItemSetId " << validItemSetId << std::endl;
  +
  if (!failing)
  rarity = getRarity(validCrateId, validItemSetId);
  failing = (rarity == -1);
  + std::cout << "rarity " << rarity << std::endl;
  +
  if (!failing)
  ret = getCrateItem(&item->sItem, validItemSetId, rarity, plr->PCStyle.iGender);
  failing = (ret == -1);
  + std::cout << "ret " << ret << std::endl;
  +
  // if we failed to open a crate, at least give the player a gumball (suggested by Jade)
  if (failing) {
  item->sItem.iType = 7;
  