there is a worldstruct change, worldstruct.xml and worldstruct.xml.patch are enclosed
zoneserver.cpp in this section removed unknown11,12 and added permission_level, added some missing packet data, and has a modifications to the way loot is derived from loot tables
the current way was o a fair loot chance at each item in the loot table, this will give an equal chance at all items in the table instead of better chance of getting something in the top of the table
zoneserver.cpp.patch enclosed
Code: Select all
packet->setDataByName("unknown9", 13);
//packet->setDataByName("unknown10", 25188959);4294967295
//packet->setDataByName("unknown10", 25190239);
packet->setDataByName("unknown10", 25191524);//25191524
packet->setDataByName("unknown10b", 1);
packet->setDataByName("permission_level",3);// added on 63182 for now till we figur it out 0=none,1=visitor,2=friend,3=trustee,4=owner
packet->setDataByName("num_adv", 9);Code: Select all
packet->setDataByName("num_adv", 9);
packet->setArrayDataByName("adv_name", "adv02_dun_drowned_caverns", 0);
packet->setArrayDataByName("adv_id", 6, 0);
packet->setArrayDataByName("adv_name", "adv02_dun_sundered_splitpaw_hub", 1);
packet->setArrayDataByName("adv_id", 5, 1);
packet->setArrayDataByName("adv_name", "exp03_rgn_butcherblock", 2);
packet->setArrayDataByName("adv_id", 8, 2);
packet->setArrayDataByName("adv_name", "exp03_rgn_greater_faydark", 3);
packet->setArrayDataByName("adv_id", 7, 3);
packet->setArrayDataByName("adv_name", "mod01_dun_crypt_of_thaen", 4);
packet->setArrayDataByName("adv_id", 3, 4);
packet->setArrayDataByName("adv_name", "mod01_dun_tombs_of_night", 5);
packet->setArrayDataByName("adv_id", 4, 5);
packet->setArrayDataByName("adv_name", "nektulos_mini01", 6);
packet->setArrayDataByName("adv_id", 0, 6);
packet->setArrayDataByName("adv_name", "nektulos_mini02", 7);
packet->setArrayDataByName("adv_id", 1, 7);
packet->setArrayDataByName("adv_name", "nektulos_mini03", 8);
packet->setArrayDataByName("adv_id", 2, 8);Code: Select all
void ZoneServer::AddLoot(NPC* npc){
vector<int32> loot_tables = GetSpawnLootList(npc->GetDatabaseID(), GetZoneID(), npc->GetLevel(), race_types_list.GetRaceType(npc->GetModelType()));
if(loot_tables.size() > 0){
vector<LootDrop*>* loot_drops = 0;
vector<LootDrop*>::iterator loot_drop_itr;
LootTable* table = 0;
vector<int32>::iterator loot_list_itr;
float chancecoin = 0;
float chancetable = 0;
float chancedrop = 0;
float chancetally = 0;
float droptally = 0;
// the following loop,loops through each table
for(loot_list_itr = loot_tables.begin(); loot_list_itr != loot_tables.end(); loot_list_itr++){
table = GetLootTable(*loot_list_itr);
if(table && table->maxcoin > 0){
chancecoin = rand()%100;
if(table->coin_probability >= chancecoin){
if(table->maxcoin > table->mincoin)
npc->AddLootCoins(table->mincoin + rand()%(table->maxcoin - table->mincoin));
}
}
int numberchances = 1;
//if (table->lootdrop_probability == 100){ }
//else
//chancetally += table->lootdrop_probability;
int maxchance = table->maxlootitems;
for ( numberchances; numberchances <= maxchance; numberchances++) {
chancetable = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / 100));
//LogWrite(PLAYER__DEBUG, 0, "Player", "Table Chance: '%f'", chancetable);
float droppercenttotal = 0;
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
if (table && (table->lootdrop_probability == 100 || (table->lootdrop_probability >= chancetable)) ) {
//LogWrite(PLAYER__DEBUG, 0, "Player", "Probability:%f Table Chance: '%f'", table->lootdrop_probability, chancetable);
loot_drops = GetLootDrops(*loot_list_itr);
if (loot_drops){
LootDrop* drop = 0;
int16 count = 0;
int16 IC = 0;
for (loot_drop_itr = loot_drops->begin(); loot_drop_itr != loot_drops->end(); loot_drop_itr++){
drop = *loot_drop_itr;
droppercenttotal += drop->probability;
}
int droplistsize = loot_drops->size();
float chancedroptally = 0;
chancedrop = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / 100));
for (loot_drop_itr = loot_drops->begin(); loot_drop_itr != loot_drops->end(); loot_drop_itr++){
drop = *loot_drop_itr;
if (droppercenttotal >= 100)
droppercenttotal = 100;
chancedroptally += 100 / droppercenttotal * drop->probability;
//chancedrop = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / 100));
//LogWrite(PLAYER__DEBUG, 0, "Player", "Loot drop: '%i' Chance: %f Prob tally: %f min: %f", drop, chancedrop, chancedroptally, chancedroptally - drop->probability);
if ((chancedroptally==100)||((chancedroptally >= chancedrop) && (chancedroptally -(100 / droppercenttotal * drop->probability)) <= chancedrop)){
//LogWrite(PLAYER__DEBUG, 0, "Player", "Loot drop: '%i' Chance: %f Prob: %f We have a loot drop winner", drop, chancedrop, chancedroptally);
count++;
npc->AddLootItem(drop->item_id, drop->item_charges);
//LogWrite(PLAYER__DEBUG, 0, "Player", "loot Count: '%i'",count);
//LogWrite(MISC__TODO, 1, "TODO", "Auto-Equip new looted items\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
//if(drop->equip_item)
}
if (table->maxlootitems > 0 && count >= table->maxlootitems)
break;
}
}
}
}
}
}
}