Thread: Loot tables
View Single Post
  #5  
Old 11-26-2002, 02:28 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Theres 2 different ones..

This ones checks for multiple drop items (like spider silk)

if (RunQuery(query, MakeAnyLenString(&query, "SELECT loottable_id, lootdrop_id, multiplier, probability FROM loottable_entries WHERE loottable_id=%i", loottable_id), errbuf, &result)) {
safe_delete(query);
while ((row = mysql_fetch_row(result))) {
int multiplier = atoi(row[2]);
for (int i = 1; i <= multiplier; i++) {
if ((rand() % 1)*100 < atoi(row[3])) {
AddLootDropToNPC(atoi(row[1]), itemlist);
}
}
}


This one calculates whether a mob has an item on its item chance list..

if (RunQuery(query, MakeAnyLenString(&query, "SELECT lootdrop_id, item_id, item_charges, equip_item, chance FROM lootdrop_entries WHERE lootdrop_id=%i", lootdrop_id), errbuf, &result))
{
delete[] query;
while ((row = mysql_fetch_row(result)))
{
if( (rand()%100) < (atoi(row[4]) * 10) )
{
int32 itemid = atoi(row[1]);
const Item_Struct* dbitem = database.GetItem(itemid);
if (dbitem == 0)
{



The 2nd one is the one to tweak. You get 10 chances on 10 low chance weapons because thats the way the emulator is currently coded. To do it the way you suggest, we'd need to implement it the way quester suggest, put items in to LOOTITEMGROUPS, say a Rusty Weapon group, then roll once on that table for a random item off it. A much better way to do it, but would require changes to the loot tables in the database and a new table for the groups. Not hard to do, just will take some work, its definately the way to go though
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote