eluna-scripts-ornfelt/lua/WowEmulationScriptPack/C++/HungerGames/HungerGamesLootItemsCreatures.cpp
2024-09-23 07:59:23 +02:00

602 lines
42 KiB
C++

#include "Creature.h"
#include "GameEventCallbacks.h"
#include "HungerGamesStore.h"
#include "Random.h"
#include "Item.h"
#include "Player.h"
#include "ObjectMgr.h"
#define CREATURE_DEATH_GIVE_ITEMS_ENTRY 123464
void DealLastBreathDamageToPlayer(Creature *Attacker, Player *Victim);
bool CanPickItem(Player *p, uint32 Entry);
bool ShouldPickItem(Player *p, uint32 Entry)
{
//already has this item ? skip adding it
if (p->GetItemCount(Entry) > 0)
return false;
//can't use it ? skip it
const ItemTemplate * itemplate = sObjectMgr->GetItemTemplate(Entry);
if (p->CanUseItem(itemplate) != EQUIP_ERR_OK)
return false;
// can we equip it ?
uint16 dest;
InventoryResult result = EQUIP_ERR_NONE;
Item* pItem = Item::CreateItem(Entry, 1, p);
if (pItem)
{
result = p->CanEquipItem(NULL_SLOT, dest, pItem, true, false);
delete pItem;
}
if (result != EQUIP_ERR_OK)
return false;
//check if player has a better one equipped
uint8 EquipSlot = p->FindEquipSlot(itemplate, NULL_SLOT, true);
Item *CurItem = p->GetItemByPos(INVENTORY_SLOT_BAG_0, EquipSlot);
if (CurItem)
{
float NewItemScore = itemplate->Armor + itemplate->Damage[0].DamageMin / (itemplate->Delay + 1) + itemplate->ItemStat[0].ItemStatValue * 10 + itemplate->ItemStat[1].ItemStatValue * 10 + itemplate->ItemStat[2].ItemStatValue * 10;
itemplate = CurItem->GetTemplate();
float OldItemScore = itemplate->Armor + itemplate->Damage[0].DamageMin / (itemplate->Delay + 1) + itemplate->ItemStat[0].ItemStatValue * 10 + itemplate->ItemStat[1].ItemStatValue * 10 + itemplate->ItemStat[2].ItemStatValue * 10;
if (OldItemScore > NewItemScore)
return false;
}
return true;
}
uint32 PickGoodItemForPlayer(Player *p, const uint32 *ItemList, uint32 ItemListSize)
{
// we should pick an item in random order
for (int32 i = 0; i < 50; i++)
{
uint32 RandomIndex = rand32() % ItemListSize;
uint32 Entry = ItemList[RandomIndex];
if (ShouldPickItem(p, Entry) == true)
return Entry;
}
//no chance in hell to pick a random item, we will pick the first good item
for (int32 i = ItemListSize - 1; i >= 0; i--)
{
uint32 Entry = ItemList[i];
if (CanPickItem(p, Entry) == true)
return Entry;
}
//no good item found
return 0;
}
bool AddTempItemToplayer(Player *p, uint32 Entry);
void PickGoodItemForPlayerAndAdd(Player *p, const uint32 *ItemList, uint32 ItemListSize)
{
uint32 SelectedEntry = PickGoodItemForPlayer(p, ItemList, ItemListSize);
if (SelectedEntry != 0)
AddTempItemToplayer(p,SelectedEntry);
}
void HungerGamesPlayerLootItemFromCreature(void *p, void *)
{
CP_CREATURE_INTERRACT *params = PointerCast(CP_CREATURE_INTERRACT, p);
//sanity check
if (params->player == NULL || params->creature == NULL)
return;
//killer player gets XP based on creature Entry
if (params->creature->GetEntry() != CREATURE_DEATH_GIVE_ITEMS_ENTRY)
return;
//no repsawning. We will spawn a new random creature
params->creature->AddObjectToRemoveList();
//the price of killing this creature
DealLastBreathDamageToPlayer(params->creature, params->player);
Player *Plr = params->player;
if (Plr->getLevel() == 80)
{
static const uint32 PossibleItems[] = { 51231,51252,51242,51266,51353,51234,51254,51240,51224,46130,51250,51244,51220,51327,50707,50993,50991,51232,51253,51287,51223,51366,51369,51351,51360,51329,51370,51352,51364,51230,51251,51243,51222,51358,42136,51516,51520,51522,51518,51452,51395,51354,51389,51391,51481,51393,51401,51233,51298,51503,51454,50704,51524,51398,51526,51446,51448,51529,51528,51535,51450,51412,51531 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 79)
{
static const uint32 PossibleItems[] = { 36055,36167,36279,36391,28168,36057,36169,36281,36393,36165,36277,36389,36051,36163,36275,36387,36056,36168,36280,36392,36052,36164,36276,36388,36058,36170,36282,36394,36054,36166,36278,36390,29279,44579,36583,36499,36527,36569,36485,36457,36625,36415,36597,36513,36611,36541,36555,36053,36695,36681,36723,36653,36639,36667 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 78)
{
static const uint32 PossibleItems[] = { 36985,44170,44109,36383,37053,37055,44190,44171,37115,37057,36946,37052,44104,44106,44189,36952,36976,44117,44122,44123,36954,37070,37105,37068,36945,37117,39657,37040,44116,36951,37043,44120,37079,44579,36582,38455,44187,36568,44051,38462,38456,44216,36596,36512,44053,36540,36980,36045,44052,49227,44241,44118,38457,36638,44108 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 77)
{
static const uint32 PossibleItems[] = { 36039,36151,35672,35670,38613,36041,37769,37779,36377,33371,37770,35675,37792,36035,36147,36259,37790,35673,35676,36264,36376,36036,36148,36260,36372,35682,36154,36266,36378,37759,36150,36262,36374,38611,44579,36581,37808,36525,36567,35681,36455,37809,37797,36595,36511,36609,36539,37806,36037,35677,36693,36679,36721,36651,36637,36665 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 76)
{
static const uint32 PossibleItems[] = { 36031,37767,36255,44695,37758,36033,36145,36257,36369,44054,44059,35588,35594,36139,37778,36363,36032,36144,35585,36368,36028,36140,36252,36364,36034,44696,36258,35593,36030,36142,36254,37789,35589,44579,36580,36496,36524,36566,36482,37810,36622,36412,36594,37812,36608,36538,35583,44062,36692,36678,36720,36650,36636,36664 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 75)
{
static const uint32 PossibleItems[] = { 36023,36135,36247,37787,43358,37757,36137,36249,43387,36133,36245,36357,36019,36131,35644,36355,43375,36136,36248,43353,36020,36132,36244,36356,35654,37766,37777,36362,35646,35647,36246,36358,43382,44579,36579,36495,36523,36565,36481,35642,36621,43363,36593,36509,37813,36537,36551,36021,36691,36677,36719,35645,36635,35652 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 74)
{
static const uint32 PossibleItems[] = { 36015,35620,36239,35639,35631,36017,36129,44685,36353,36125,36237,36349,36011,36123,36235,36347,35635,37765,35619,37786,36012,35641,36236,36348,36018,36130,35640,44691,36014,44686,36238,36350,37821,44579,36578,35630,37807,36564,36480,36452,36620,38353,36592,36508,36606,35618,35633,35632,33426,36690,33425,36676,38357,36648,36634,38356 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 73)
{
static const uint32 PossibleItems[] = { 36007,36119,37775,36343,35610,36009,36121,35616,36345,36117,36229,43279,36003,36115,36227,35608,37755,36120,36232,36344,36004,36116,36228,36340,36010,36122,35615,36346,35611,35607,36230,36342,43277,44579,36577,36493,36521,36563,35606,36451,36619,43278,37811,36507,36605,36535,36549,36005,36689,36675,36717,36647,36633,36661 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 72)
{
static const uint32 PossibleItems[] = { 37754,36111,36223,36335,28168,36001,35660,36225,36337,51958,36221,36333,35995,36107,36219,36331,36000,44676,37774,36336,35657,35659,36220,36332,44674,36114,36226,36338,35998,36110,44675,37795,37820,44579,36576,36492,36520,36562,35655,36450,36618,37796,36590,36506,36604,36534,35658,35997,36688,36674,36716,36646,36632,36660 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 71)
{
static const uint32 PossibleItems[] = { 35991,36103,36215,36327,28168,35993,36105,36217,35602,33364,36101,36213,36325,35987,35605,37773,36323,35992,36104,36216,36328,35988,37763,35600,35603,35994,36106,36218,35604,35990,36102,35599,36326,37819,44579,34672,36449,36407,37803,37753,35601,35617 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 70)
{
static const uint32 PossibleItems[] = { 35097,34404,35044,34400,34178,35096,35001,35046,35092,29117,35002,30185,35088,35164,35152,35157,35163,35100,35000,35045,35091,35149,34573,35142,35148,35179,35167,35172,34433,43073,34998,35043,35089,37927,41589,34996,35071,34164,36560,35093,30314,30318,41592,34997,34989,37461,35015,35103,35099,31042,35042,35110,36686,32837,35076,36672,34995,34988,35072,35037,35058,35108,35075,35018,35107 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 69)
{
static const uint32 PossibleItems[] = { 37746,36087,36199,36311,37748,35977,36089,31294,36313,37745,36197,36309,35971,36083,31293,36307,35976,36088,36200,37743,35972,36084,37744,36308,35978,36090,36202,36314,35974,36086,36198,36310,24079,44579,36573,36489,36517,36559,36475,37747,36615,36405,31291,36503,36601,36531,36545,31297,36685,36671,36713,36643,36629,36657 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 68)
{
static const uint32 PossibleItems[] = { 35967,36079,36191,36303,28168,35969,31190,36193,36305,21855,36077,36189,36301,35963,36075,36187,36299,35968,36080,36192,36304,27919,27914,27915,27788,35970,36082,36194,27918,35966,36078,36190,36302,24087,44579,36572,36488,36516,36558,36474,31287,36614,36404,36586,31299,36600,36530,31289,29143,29118,35965,36684,36670,27916,36642,36628,36656 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 67)
{
static const uint32 PossibleItems[] = { 35959,36071,36183,36295,31275,35961,36073,36185,36297,36069,36181,36293,35955,36067,36179,36291,35960,36072,36184,36296,35956,36068,36292,35962,36074,36186,36298,35958,36070,31280,36294,28553,44579,36571,36487,36515,36557,36473,36445,36613,31341,36585,36501,36599,36529,36543,35957,36683,36669,36711,36641,36627,36655 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 66)
{
static const uint32 PossibleItems[] = { 28760,28574,28577,28761,27440,27433,27434,24884,38663,24767,24880,27427,27638,27645,27643,27644,27418,27648,27647,27653,24654,24766,24879,27420,31225,31224,31223,31221,31166,31165,27428,31163,27436,44579,27424,31234,29391,25081,27423,25137,29377,30570,20034,27426,29380,29371,27431,29372,30568,29378 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 65)
{
static const uint32 PossibleItems[] = { 27410,27409,31222,27408,28168,19841,22112,19831,38663,42099,19828,19822,22078,42084,22010,38668,22067,31226,22100,38669,27411,42088,38670,22063,42092,22095,38666,42097,38667,27413,31080,25964,31200,39522,38707,27412,20034,31204 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 64)
{
static const uint32 PossibleItems[] = { 24641,24753,25955,24978,25954,24643,24755,25947,24980,24639,24751,24864,24976,24637,24749,24862,24974,24642,24754,24867,24979,25957,25946,25941,24975,24644,24756,24869,25956,24640,24752,24865,31180,25962,44579,25205,25121,25952,25107,28166,25953,25945,25219,25944,31186,20034,25317,25943,25303,25191,25939 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 63)
{
static const uint32 PossibleItems[] = { 12752,25617,20134,38661,24460,19841,22112,19831,24457,24455,24465,31152,22078,22106,22010,31151,22067,24466,22100,24456,20715,31173,38670,31192,31175,24451,31188,24450,24452,20712,38667,29279,44579,31153,29456,24464,39173,24454,24461,38707,20724,24481,29457,27631 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 62)
{
static const uint32 PossibleItems[] = { 24625,31145,24850,24962,31147,24627,24739,24366,24964,24623,25838,24357,24363,31231,31229,24360,31227,24359,24738,24851,24364,31236,31235,31233,31232,24628,24740,24853,24965,31149,24365,31177,31176,29279,24376,25203,25119,25147,29150,25828,27930,24379,25217,25133,25231,25161,25835,20034,24378,24361,25301,25189,27929,24381,29149 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 61)
{
static const uint32 PossibleItems[] = { 22065,25617,20134,22091,24385,31250,31148,31248,31247,24396,22102,31136,24395,24725,24388,19826,22067,24391,31243,31242,22064,24726,22096,38670,24392,24732,22095,19827,24393,22110,22099,24387,24075,44579,20723,31139,34672,39173,31140,24394,38707,20724,24397,24384,31142,24389 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 60)
{
static const uint32 PossibleItems[] = { 22514,21353,16578,21387,19491,22515,16449,16580,21391,22652,21364,21374,21331,22518,22482,21607,21606,22513,22741,21375,21390,22516,16459,21373,21388,22519,21602,22471,22423,22517,21605,21599,21623,24151,44579,19362,19335,21395,19346,21610,21616,21409,18831,21407,24044,31134,24155,18714,22512,30751,21398,21413,30755,23451,18848,21800,18837,19927 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 59)
{
static const uint32 PossibleItems[] = { 22065,25617,20134,22091,14558,19841,19835,19831,38663,22113,22102,19822,19842,19839,19832,19826,22067,22111,22100,38669,22064,22107,22096,38670,19843,19836,22095,19827,22066,22110,22099,22090,29279,44579,20723,34672,39173,17523,38707,20724,22083 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 58)
{
static const uint32 PossibleItems[] = { 22065,25617,20134,22091,22327,19841,19835,19111,38663,16706,16674,16726,20047,20046,20195,13502,22067,22111,22100,22328,20054,20053,20051,20049,18456,19113,18448,19112,10251,22110,22099,22090,19510,44579,20723,19550,19542,39173,19558,23127,17074,38707,19566,16700 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 57)
{
static const uint32 PossibleItems[] = { 16693,16707,16667,16727,18723,14538,18374,18686,38663,13944,18530,18503,19842,18505,19832,19826,22303,18390,20668,18690,18507,13398,18047,14537,23129,24700,13528,13951,23128,22110,22099,18722,22334,44579,18737,23132,18758,14528,18689,18759,22333,18502,13163,13937,22083,20666,13964,18755,18761 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 56)
{
static const uint32 PossibleItems[] = { 13390,18490,20134,10379,13960,22305,18528,19831,13955,13388,12603,14536,19822,22306,12606,18393,10387,16687,16719,16668,18861,13391,22472,13260,13259,22313,13208,13969,18741,22304,13184,18349,18383,13392,44579,18347,13401,18484,22317,13218,18485,22318,13397,12000,13393,22314,14541,13161,22083,22315,13474,18738,18483 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 55)
{
static const uint32 PossibleItems[] = { 12604,12960,8308,18480,19096,16701,16718,16669,13166,18478,10230,13168,23126,13252,19092,19091,8289,9402,22100,13498,20652,18476,8307,10376,10136,10147,13179,18459,18387,20661,13244,12637,13096,44579,20723,13204,18463,18462,20657,13375,20663,13203,12000,13167,20660,34661,13372,19319,19320,18450,18048,28972,18460,13534 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 54)
{
static const uint32 PossibleItems[] = { 18727,8299,10235,10372,13002,8288,13257,19831,12557,10104,22113,22102,13394,13403,10145,8306,10381,3949,11823,10236,10280,13282,16715,13402,18692,12626,18726,13135,13400,16684,16712,16672,16737,13283,44579,12621,18671,14576,18491,18673,12653,13376,15272,14531,18725,15256,17191,10102,13399,13474,12651,18338 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 53)
{
static const uint32 PossibleItems[] = { 8292,18325,18319,18313,18317,19841,19835,10237,10281,10181,13378,11820,10164,16702,16713,16680,13384,10101,11821,13383,11802,18307,18322,13284,13070,10213,18700,8302,19827,18306,18744,11814,10369,18302,44579,13286,34672,18491,11785,18323,12608,18324,13047,13817,18311,10178,25878,2099,18301 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 52)
{
static const uint32 PossibleItems[] = { 10097,13404,11729,22091,13091,11782,22241,19831,13405,3951,3976,11726,8312,19842,13118,11783,13077,18745,22271,11728,10169,8284,18043,11731,38670,16703,16714,16671,16722,22256,8298,11730,10277,22255,44579,811,18044,13182,24222,8320,8304,12000,11921,16039,17191,22083,11923,25878,13825,22254 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 51)
{
static const uint32 PossibleItems[] = { 8754,18698,20134,11746,11755,13013,19835,22212,10170,8245,8258,8265,19822,8291,8293,22242,19826,10177,18298,13130,8318,22245,10106,22096,10276,8285,8295,18296,10282,22066,12547,10121,11745,12056,44597,11920,11805,2244,11744,18491,13254,12551,13003,11803,11809,11786,12532,8252,13818,25878,13248,13040,12605 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 50)
{
static const uint32 PossibleItems[] = { 11839,10187,8270,22223,16309,10172,11685,11722,14552,10806,12793,10193,11678,19842,11686,10122,11703,11841,22111,22100,8085,18697,11675,8269,22270,19596,19589,19583,19580,10808,10110,22099,10165,19302,44597,11702,15229,8190,12791,10195,13022,13122,12000,38707,17191,2662,2663,10065,29013,13474,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 49)
{
static const uint32 PossibleItems[] = { 3075,8261,8752,8317,28168,19841,19835,8272,8086,22113,3999,11633,11662,10109,8268,10166,8251,8262,10199,10244,10179,13111,22096,38670,12546,10107,10126,10171,11634,11665,8267,22090,11824,44597,10805,1721,12535,11635,1203,15804,12000,15254,812,22083,13820,25878,13474,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 48)
{
static const uint32 PossibleItems[] = { 8254,25617,10198,17734,19539,17732,8263,10200,10245,9946,9950,10077,19822,13144,20103,20196,20106,10064,10074,11749,38669,20094,20100,11627,20109,10173,19836,22095,8311,22066,10186,13126,8314,19511,44597,13014,13027,19555,19547,17718,19563,11626,17730,38707,11750,9943,11747,11784,25878,17717,11748 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 47)
{
static const uint32 PossibleItems[] = { 22065,10073,12549,13073,11946,11624,3975,10085,11632,22113,22102,10203,10180,10190,10197,8315,13008,22111,10084,10133,8246,8256,22096,10238,19843,10800,8264,19827,8249,8260,10196,10242,12055,44597,15236,16769,34672,18491,11631,11623,12000,12528,13059,13052,15274,17050,13816,25878,13474,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 46)
{
static const uint32 PossibleItems[] = { 10630,17740,17767,10132,1315,10063,17749,19831,13066,17742,8126,8274,8253,19839,19832,10798,22067,17751,8132,10633,17748,10068,10082,38670,8247,19836,10191,17746,10062,10072,17007,22090,29279,44597,20723,15216,12531,8134,15291,17739,12000,10799,38707,13823,12542,11603,17738,25878,13474,17745 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 45)
{
static const uint32 PossibleItems[] = { 9940,9479,8131,8092,18444,19841,9955,8133,9476,8106,7527,9957,8094,3587,8255,10081,10130,9942,2472,2425,10208,10629,2473,13125,10131,18437,18435,18432,18430,2440,2564,10080,10129,29279,44597,9478,17055,17054,15245,1979,13824,18441,12000,13046,38707,9477,7518,11086,25878,13139,13065 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 44)
{
static const uint32 PossibleItems[] = { 9470,25617,20134,10207,13089,9941,19835,9965,38663,9473,22102,10086,17755,10067,13134,19826,8112,9474,17754,8280,9936,9948,8130,38670,19843,10069,10632,10127,9939,9952,8128,10205,29279,44597,20723,15227,13035,17752,7537,11308,13109,9481,9475,13043,17191,22083,25878,13474,9483 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 43)
{
static const uint32 PossibleItems[] = { 8115,13112,9963,8279,9641,8111,8124,19831,8281,9905,9924,9469,19822,9945,9947,19832,10206,22067,7528,7539,38669,22064,3962,9962,10201,9937,9949,8125,13076,3940,22110,22099,9640,6440,44597,10623,9639,34672,18491,2040,9938,13018,3208,9480,10628,17191,9913,4019,25878,4089,13039,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 42)
{
static const uint32 PossibleItems[] = { 13102,7529,13128,22091,5029,19841,7532,7543,10092,22113,4082,8138,8114,8116,9961,19826,7519,22111,22100,10091,8107,12470,22096,8278,8108,19836,22095,19827,18083,8121,9960,8276,29279,44597,20723,1608,754,4091,4069,13021,8127,12000,4983,8199,18082,22083,25878,13474,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 41)
{
static const uint32 PossibleItems[] = { 22065,25617,20134,10090,28168,7523,19835,4733,38663,7113,6430,22102,19822,7526,7535,7546,8277,12255,9922,4084,13074,10026,7531,7542,38670,9433,8118,9956,8273,7521,7530,10631,10087,10634,44597,1994,4090,9511,18491,13082,9512,15270,15262,2529,1720,6427,2530,2532,2528,25878,13474,5239 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 40)
{
static const uint32 PossibleItems[] = { 9915,9921,4080,10763,9243,11310,13115,9430,8144,9415,7477,9928,10775,19842,19839,20198,20107,4046,9414,4478,8162,7522,22107,20122,20110,19597,19590,19584,19581,22066,22110,22099,13071,11118,21567,2815,13026,34672,2164,9918,15287,11311,12000,9413,9416,9418,2535,7468,15215,25878,9412,5238 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 39)
{
static const uint32 PossibleItems[] = { 7720,25617,9932,22091,7722,19841,4737,9934,38663,22113,1715,19822,9906,9916,6425,19826,7469,22111,22100,38669,13100,9917,22096,38670,3938,9925,22095,19827,9910,9920,4083,22090,7552,32864,20723,4511,34672,2534,7726,12254,9425,7723,13058,13051,1613,22083,7721,25878,3430,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 38)
{
static const uint32 PossibleItems[] = { 9431,6433,20134,22091,1714,4734,19835,13132,38663,9874,9887,22102,19822,20098,20104,9931,19826,22067,1718,10330,38669,20161,20101,9926,38670,9909,3963,6426,19827,6428,4063,9930,22090,19512,32864,20723,8194,9401,19544,7496,19560,19528,12000,4983,15251,19568,9884,25878,9422,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 37)
{
static const uint32 PossibleItems[] = { 2624,7479,7719,22091,28168,7473,10774,7718,38663,22113,10764,19822,4736,13117,10768,19826,9883,9893,9903,38669,22064,7481,7490,38670,4045,4061,9409,19827,7471,10765,22099,22090,29279,32864,20723,9427,34672,10761,10767,2825,6424,7717,1722,4018,9408,10762,25878,13138,13064 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 36)
{
static const uint32 PossibleItems[] = { 9878,25617,9902,22091,13088,19507,9389,9904,38663,7112,4058,6411,19822,10771,7485,7494,19826,22067,22111,22100,38669,7472,22107,19509,38670,7475,19508,13199,19827,22066,7480,7489,22090,29278,32864,10772,4511,9424,18491,1204,9400,6432,12000,4983,13042,17191,6415,25878,13474,5215 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 35)
{
static const uint32 PossibleItems[] = { 10574,9889,20134,22091,28168,19841,19835,4725,38663,10581,7439,22102,19822,3985,19839,9901,19826,9407,4060,4079,38669,19969,9398,9895,38670,19843,19836,9388,19827,9390,9892,9900,22090,5011,9149,20723,4511,9392,5742,9403,10776,9383,15261,13054,10758,873,1716,15234,3787,25876,13474,13038,10766 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 34)
{
static const uint32 PossibleItems[] = { 4041,6422,4078,22091,28168,4729,4731,3814,38663,10583,10328,19822,9875,7387,19832,19826,7431,7760,13129,38669,22064,6420,6412,38670,9879,13119,9896,19827,4042,10760,22099,22090,29278,32864,1602,7736,1265,8006,4067,13020,9397,10570,4983,7758,38707,7713,22083,15233,7714,25878,15322,10572 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 33)
{
static const uint32 PossibleItems[] = { 7432,9375,7456,22091,28168,7712,7755,7459,38663,9844,9854,7759,19822,19842,6421,4727,19826,22067,22111,22100,38669,10578,22107,22096,38670,4043,19836,3810,19827,22066,5966,1988,22090,29277,32864,7761,936,864,1465,13081,10567,13121,12000,15260,38707,937,7711,3785,25878,13474,9381 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 32)
{
static const uint32 PossibleItems[] = { 2622,9420,3891,22091,28168,19841,4810,9872,38663,7111,2463,2417,19822,13105,2464,10329,19826,9851,9862,9871,38669,7434,2276,1678,38670,3594,4059,6413,19827,7433,7443,7457,22090,13093,32864,934,13025,8223,5756,9873,5257,12000,6327,10573,7757,4038,15226,25878,8188,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 31)
{
static const uint32 PossibleItems[] = { 9849,3011,9870,22091,28168,9850,19835,19831,38663,13110,4074,19822,7438,7448,19832,19826,6405,22111,6402,38669,22064,10582,9864,38670,7437,7447,10333,19827,9848,3804,10584,22090,2951,32864,20723,9386,8225,9384,4065,4726,12000,1679,1726,9385,7710,22083,2520,25878,3025,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 30)
{
static const uint32 PossibleItems[] = { 7691,4052,4077,22091,13084,7684,4721,6404,38663,7353,9406,7688,19822,19842,9855,9869,19826,2277,4054,3813,38669,9845,3801,13124,38670,9846,9428,22095,19827,22066,7690,23170,22090,7686,38675,6692,9457,19040,6691,4066,15286,18440,2523,13045,15811,7689,17191,7371,7369,2522,15904,23168,15909,25878,9456,7708 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 29)
{
static const uint32 PossibleItems[] = { 7357,25617,20134,22091,5180,14201,19835,19831,38663,9819,22113,22102,19822,9853,6409,4717,19826,7368,6690,7423,38669,6406,4055,7417,38670,19843,9857,9865,19827,9395,7756,9445,22090,34227,38675,2080,19292,13033,7683,12248,4477,3037,13108,12250,1991,3781,3185,7728,2524,25878,13137,15809,13063 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 28)
{
static const uint32 PossibleItems[] = { 9492,3020,5819,22091,19541,7367,7408,7424,38663,9835,9836,19822,20164,20105,20108,19826,9825,9833,22100,38669,20162,20102,20111,38670,6407,6410,6403,19827,14199,22110,7421,22090,19513,38675,15232,7752,19557,19545,9458,19561,19533,9459,9449,25464,2877,19573,22083,15225,25878,7729,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 27)
{
static const uint32 PossibleItems[] = { 2721,6204,6686,22091,6695,6697,7727,9842,38663,6609,6396,22102,19822,14205,7406,7422,19826,6616,3805,9841,38669,9454,22107,9510,38670,19843,19836,22095,19827,9491,7412,4465,22090,6693,38675,20723,4511,19040,6681,6694,6696,4719,6687,6953,25464,15250,6689,6610,2816,25878,13474,13037,5214 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 26)
{
static const uint32 PossibleItems[] = { 10288,4048,6389,22091,5003,19841,2278,14758,38663,7110,4255,1488,19822,4463,15136,9840,19826,22067,4050,22100,38669,14399,14579,4073,38670,13106,7410,7416,19827,14403,9832,9839,22090,5007,38675,15231,13048,8226,776,7787,3778,4462,12249,6953,25464,13049,791,6682,25878,3041,9489 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 25)
{
static const uint32 PossibleItems[] = { 22065,3392,8748,22091,5002,6685,2264,6388,38663,2234,6603,914,19822,14406,9827,15539,19826,4037,13114,6386,38669,22064,7754,22096,38670,9821,6198,4438,19827,22066,22110,4072,22090,13094,38675,7786,4511,19040,15242,13079,7419,3210,6953,25464,2084,17191,22083,3186,25878,13474,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 24)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,38662,6395,7415,13131,38663,9791,22113,6592,19822,4829,6911,4712,19826,6910,4832,22100,38669,13099,22107,6590,38670,19843,897,6387,19827,6615,6397,22099,22090,2039,38675,4825,13024,19040,3336,6599,15284,6901,756,1976,6679,9490,1155,9798,1829,25878,9487,8184 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 23)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,38662,1785,19835,4833,38663,9809,3053,19822,4827,19839,6594,19826,6903,4830,6596,38669,6612,6601,22096,38670,1351,2017,1756,19827,6393,720,6906,22090,19065,38675,20723,9488,753,6904,6598,2785,13005,2015,3203,13057,1975,1831,22083,1825,25878,13474,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 22)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,38662,14378,14573,4705,38663,6608,6525,4448,19822,4714,13011,2148,19826,9772,2233,15521,38669,6394,2143,3045,38670,4036,6902,13012,19827,2158,1978,3047,22090,4999,38675,1454,3414,1493,4449,3656,8183,4715,2227,2058,25464,38707,2280,3069,1827,15212,25875,2098,6315,13062 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 21)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,38662,3748,15116,14749,38663,14158,3055,3416,19822,9799,15120,4707,19826,3067,4831,13010,38669,14176,9802,22096,38670,14177,3204,3228,19827,14377,22110,15520,22090,6321,38675,4826,4511,2011,2942,4454,15891,3078,4713,13016,924,25464,3417,6318,2800,923,25878,3024,8186 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 20)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,38662,12998,14566,3231,38663,6567,6584,6642,19822,6392,9801,15515,19826,23173,22111,14748,38669,2232,15330,9810,38670,14375,12999,5943,19827,9771,3058,9813,22090,6463,21566,1292,6323,3935,3413,6320,3021,6314,3191,911,12989,6641,6631,6324,15230,925,15903,15907,25878,13474,5211 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 19)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,38662,6566,15313,6579,38663,5202,10399,15500,19822,4708,6319,6460,19826,6568,15117,4816,38669,14374,1121,14742,38670,19843,3202,9811,19827,3066,14572,1750,22090,12054,38675,885,6472,2046,2209,12997,6469,2059,1455,6953,25464,4818,3415,14127,15223,3740,25878,13474,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 18)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,20442,14126,5404,1445,22001,14369,6473,14730,19822,2911,14567,5750,19826,22067,10410,4800,22092,3065,10411,6459,22087,3647,15331,22095,19827,5970,6586,12994,22090,20439,17759,12990,4511,6633,20443,4821,20438,6629,5194,7230,25464,12992,5201,6226,790,25878,13474,5092 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 17)
{
static const uint32 PossibleItems[] = { 22065,22109,20134,22091,12059,14368,10405,4694,9531,200,12988,285,12895,1299,1215,14746,19826,12987,9781,15503,20700,202,6582,287,22087,3598,14569,14743,19827,6628,15115,718,22090,6332,17759,5196,4439,5192,6448,6571,6449,3199,1820,25464,4817,17191,6465,1819,789,25878,2783,5198 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 16)
{
static const uint32 PossibleItems[] = { 19972,19039,12018,12059,4698,4700,15496,9531,6561,2985,2989,4436,10412,19125,1776,5199,2990,2168,10702,12982,17688,11469,6583,4118,4121,19119,6974,19126,12052,30696,4949,5197,1937,2169,3655,3026,22990,872,12983,25464,2024,17191,2981,25878,13136,15808,12984 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 15)
{
static const uint32 PossibleItems[] = { 19972,19039,12018,7888,1769,5254,1744,9531,4781,1794,9783,4786,4131,5425,2982,5422,2166,6095,4788,1739,17688,6563,1789,4118,14168,1314,1448,19126,12038,30696,5426,4511,29583,3184,5443,6632,5423,5187,25464,1460,1300,4120,25874,13474,5243 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 14)
{
static const uint32 PossibleItems[] = { 19972,19039,7130,7888,3560,9531,6536,6552,4138,10462,9775,1738,5016,4108,1943,14174,1788,1446,17688,14166,9777,3211,1767,10413,9787,19126,2933,30696,3755,1440,1469,2235,9790,11304,5444,2203,4778,25464,1387,1473,6538,1816,15222,1817,29584,3040,19118 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 13)
{
static const uint32 PossibleItems[] = { 19972,19039,7130,7888,3560,9531,26005,31263,6545,5967,1787,9788,1929,10400,4741,4660,2987,6666,17688,14148,26028,14147,2984,1945,1742,19126,2933,31268,2821,14145,14151,4290,24136,14149,3195,4777,25464,2822,3902,14150,2781,24138,31270 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 12)
{
static const uint32 PossibleItems[] = { 19972,4124,7130,10824,3560,2969,4243,847,28155,6379,28162,838,845,6546,2983,843,6551,17688,3645,3205,9785,839,6554,2274,2933,3755,1214,4987,820,6560,28152,6378,1959,6953,25464,2204,1405,6528,1815,29200,24138,5212 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 11)
{
static const uint32 PossibleItems[] = { 19972,4124,7130,7746,3560,26005,6670,2977,6539,4246,6548,2970,2974,4741,6095,6557,6666,17688,4979,26028,1740,6541,4980,6974,2933,853,4511,1219,2207,6559,2507,4701,15268,6953,25464,4567,1928,4120,25873,29200,24138,16789 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 10)
{
static const uint32 PossibleItems[] = { 4385,6720,7130,3560,9749,1211,6195,2283,2899,832,5016,26021,2978,22991,22992,3302,6543,6556,6550,4768,2312,2980,2933,826,1926,851,2088,3653,3036,1355,6206,6205,25464,28164,1933,11362,11363,22986,2073,15905,15906,29200,24138,16789 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 9)
{
static const uint32 PossibleItems[] = { 4385,7130,3560,26005,6670,1737,4687,4693,4678,9747,15303,9763,2971,2975,2979,3643,15013,1732,2972,15300,3304,2933,3755,852,4765,2632,3654,28152,15490,1196,1514,25464,1513,5340,5812,1516,4569,2511,24138,5071 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 8)
{
static const uint32 PossibleItems[] = { 4385,7130,2913,3292,2087,3330,4684,4690,15480,3291,38513,6973,14110,15301,15481,26015,3312,3213,9746,9755,9762,2933,2265,4766,2266,9764,2777,15015,1893,4564,25464,6741,4566,6512,1511,4577,24138,6677 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 7)
{
static const uint32 PossibleItems[] = { 4368,2913,26005,2069,24107,9742,9750,9758,6267,3287,3282,9743,3284,3279,9744,9752,3303,3290,3286,15484,6678,4303,5744,7298,9753,28152,4692,1512,2254,25464,3192,1515,5812,2075,3567,24138,5069 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 6)
{
static const uint32 PossibleItems[] = { 4368,2957,2961,2965,26013,15302,2546,10554,15009,15477,3289,6518,6506,14095,15297,15482,6202,6521,6510,1449,2281,3223,3572,816,7108,8180,9761,1893,39202,5340,6511,4561,3329,3567,24138,5252 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 5)
{
static const uint32 PossibleItems[] = { 4368,795,3000,2398,6513,6517,6509,2958,2962,2966,792,6201,15473,7350,6519,6507,14089,15008,15476,5351,727,1917,4263,28152,15483,4562,39202,8178,7094,7509,1913,2282,3567,24138,5252 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 4)
{
static const uint32 PossibleItems[] = { 26005,2112,24107,4663,4666,15472,26007,26021,7095,15004,3332,3373,15005,3214,2960,12522,2968,2490,2488,3225,15006,28152,6520,3325,1414,39202,3327,3328,768,4563,2065,8181,24138 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 3)
{
static const uint32 PossibleItems[] = { 5420,26018,24107,3370,15003,4659,4261,26020,2646,26010,1419,18612,14087,3200,15474,26008,26022,3455,2494,17186,2506,15475,3189,3190,39202,3335,2114,2066,2259,2258,25872,15807 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 2)
{
static const uint32 PossibleItems[] = { 44647,33292,23324,42985,44105,44101,44099,1433,24111,2898,24109,1418,15794,18611,34683,24112,24103,24113,1430,1359,2645,2492,44096,2138,2213,42946,2165,42943,3334,39202,8177,23553,34685,23399,778,766,42945,8182 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
if (Plr->getLevel() == 1)
{
static const uint32 PossibleItems[] = { 44647,33292,23324,42985,44105,44101,44099,20990,85,2379,48685,20989,4951,20914,194,20924,20918,34683,20985,20921,20915,20988,20922,20916,20987,1422,20917,2134,20851,20849,4565,2212,20910,3322,2479,2480,39202,1194,2132,5439,5441,34685,2110,2054,2055,18610,25861,2508 };
PickGoodItemForPlayerAndAdd(Plr, PossibleItems, _countof(PossibleItems));
}
//potions
if (Plr->getLevel() == 80)
{
AddTempItemToplayer(Plr, 33447);
AddTempItemToplayer(Plr, 33448);
}
else if(Plr->getLevel() >= 55)
{
AddTempItemToplayer(Plr, 22829);
AddTempItemToplayer(Plr, 22832);
}
else if (Plr->getLevel() >= 45)
{
AddTempItemToplayer(Plr, 13446);
AddTempItemToplayer(Plr, 13443);
}
else if (Plr->getLevel() >= 35)
{
AddTempItemToplayer(Plr, 3928);
AddTempItemToplayer(Plr, 6149);
}
else if (Plr->getLevel() >= 21)
{
AddTempItemToplayer(Plr, 1710);
AddTempItemToplayer(Plr, 3827);
}
else if (Plr->getLevel() >= 12)
{
AddTempItemToplayer(Plr, 929);
AddTempItemToplayer(Plr, 3385);
}
else if (Plr->getLevel() >= 3)
{
AddTempItemToplayer(Plr, 858);
AddTempItemToplayer(Plr, 2455);
}
#if 0
HungerGameStore *ActiveHG = IsHungerGamesActiveForPlayer(params->player);
if (ActiveHG == NULL)
return;
uint32 SelectedEntry = PickGoodItemForPlayer(params->player, ActiveHG->GetLootList());
//could not get an item to be given to the player
if (SelectedEntry != 0)
{
AddTempItemToplayer(Plr, SelectedEntry);
AddTempItemToplayer(Plr, 33447);
AddTempItemToplayer(Plr, 33448);
return;
}
#endif
#if 0
//based on time, we should give players relevant, stronger and stronger items
#define MAX_ITEM_LEVEL_TO_SEARCH 296
Player *Plr = params->player;
uint32 SlotRandomizer = rand32() % (INVTYPE_RELIC + 1);
for (int i = INVTYPE_HEAD; i <= INVTYPE_RELIC; i++)
{
uint32 RandomSlot = (SlotRandomizer + i ) % (INVTYPE_RELIC + 1);
Item *PrevItem = Plr->GetItemByPos(INVENTORY_SLOT_BAG_0, RandomSlot);
//search for an item that is better than the one we have
if (PrevItem != NULL)
{
}
//search first item that we can use in this slot
else
{
for (static uint32 Entry = 0; Entry < 60000; Entry++)
{
if (Plr->CanUseItem(sObjectMgr->GetItemTemplate(Entry)) != EQUIP_ERR_OK)
continue;
// can we equip it ?
uint16 dest;
InventoryResult result = EQUIP_ERR_NONE;
Item* pItem = Item::CreateItem(Entry, 1, Plr);
if (pItem)
{
result = Plr->CanEquipItem(RandomSlot, dest, pItem, true, false);
delete pItem;
}
if (result != EQUIP_ERR_OK)
continue;
Plr->AddItem(Entry, 1);
break;
}
}
//loot has it's price
DealLastBreathDamageToPlayer(params->creature, params->player);
//nothing left to do
return;
}
#endif
}