Fixed: NPC merchants with type 'sale'

This commit is contained in:
kervala 2011-02-09 14:36:30 +01:00
parent 8192e96ef6
commit 352f937243

View file

@ -517,28 +517,42 @@ bool CNpcChatProfileImp::parseChatArgs(CAIInstance *aiInstance, const std::strin
sale.setSheetId(CSheetId(parts[i]+".sitem")); sale.setSheetId(CSheetId(parts[i]+".sitem"));
if (sale.getSheetId() == CSheetId::Unknown) if (sale.getSheetId() == CSheetId::Unknown)
return false; return false;
break;
case RYMSG::TExplicitSaleType::est_named_item: case RYMSG::TExplicitSaleType::est_named_item:
sale.setNamed(parts[i]); sale.setNamed(parts[i]);
if (sale.getNamed().empty()) if (sale.getNamed().empty())
return false; return false;
break;
case RYMSG::TExplicitSaleType::est_brick: case RYMSG::TExplicitSaleType::est_brick:
sale.setSheetId(CSheetId(parts[i]+".sbrick")); sale.setSheetId(CSheetId(parts[i]+".sbrick"));
if (sale.getSheetId() == CSheetId::Unknown) if (sale.getSheetId() == CSheetId::Unknown)
return false; return false;
break;
case RYMSG::TExplicitSaleType::est_phrase: case RYMSG::TExplicitSaleType::est_phrase:
sale.setSheetId(CSheetId(parts[i]+".sphrase")); sale.setSheetId(CSheetId(parts[i]+".sphrase"));
if (sale.getSheetId() == CSheetId::Unknown) if (sale.getSheetId() == CSheetId::Unknown)
return false; return false;
break;
case RYMSG::TExplicitSaleType::est_dappers: case RYMSG::TExplicitSaleType::est_dappers:
{
// read the amount of dapper // read the amount of dapper
sale.setQuantity(atoi(parts[i].c_str())); uint32 quantity;
NLMISC::fromString(parts[i], quantity),
sale.setQuantity(quantity);
break;
}
default: default:
STOP("Unsupported sale type "<<sale.getSaleType().toString()); STOP("Unsupported sale type "<<sale.getSaleType().toString());
} }
break; break;
case 3: case 3:
{
// read the quality // read the quality
sale.setQuality(atoi(parts[i].c_str())); uint32 quality;
NLMISC::fromString(parts[i], quality);
sale.setQuality(quality);
break;
}
case 4: case 4:
// read the money (may be more than one) // read the money (may be more than one)
if (!parts[i].empty()) if (!parts[i].empty())