stoneharry

Untitled

Jun 27th, 2011
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. // Static AV Loot Table
  2. struct AVLoot
  3. {
  4.     uint32 ItemId;
  5.     int8 Faction;
  6.     float Chance;
  7.     uint32 MinCount;
  8.     uint32 MaxCount;
  9. };
  10.  
  11. const static AVLoot g_avLoot[] = {
  12.    
  13.     // Alliance Loot
  14.     { 17306,    0,      100.0f, 1, 1 },         // Stormpike Soldier's Blood
  15.     { 17326,    0,      80.0, 1, 1 },               // Stormpike Soldier's Meat
  16.  
  17.     // Horde Loot  
  18.     { 17423,    1,      50.0f, 1, 1 },          // Crystal Cluster
  19.  
  20.     // Global loot
  21.     { 17422,    -1,     100.0f, 1, 5 },         // Armor Scrap
  22.  
  23.     // EOF
  24.     { 0, 0, 0},
  25. };
  26.  
  27. void AlteracValley::HookGenerateLoot(Player *plr, Object *pCorpse)
  28. {
  29.     const AVLoot *loot_ptr = &g_avLoot[0];
  30.     while(loot_ptr->ItemId != 0)
  31.     {
  32.         if( loot_ptr->Faction == -1 || loot_ptr->Faction == static_cast<int8>( plr->GetTeam() ))
  33.         {
  34.             if( Rand(loot_ptr->Chance * sWorld.getRate(RATE_DROP0)) )
  35.             {
  36.                 __LootItem li;
  37.                 ItemPrototype *pProto = ItemPrototypeStorage.LookupEntry(loot_ptr->ItemId);
  38.                 if( pProto != NULL )
  39.                 {
  40.                     li.ffa_loot = 0;
  41.                     li.item.displayid = pProto->DisplayInfoID;
  42.                     li.item.itemproto = pProto;
  43.                     if( loot_ptr->MinCount != loot_ptr->MaxCount )
  44.                         li.iItemsCount = RandomUInt(loot_ptr->MaxCount - loot_ptr->MinCount) + loot_ptr->MinCount;
  45.                     else
  46.                         li.iItemsCount = loot_ptr->MinCount;
  47.  
  48.                     li.iRandomProperty = NULL;
  49.                     li.iRandomSuffix = NULL;
  50.                     li.passed = false;
  51.                     li.roll = NULL;
  52.  
  53.                     // push to vector
  54.                     TO< Corpse* >(pCorpse)->loot.items.push_back(li);
  55.                 }
  56.             }
  57.         }
  58.  
  59.         ++loot_ptr;
  60.     }
  61.  
  62.     // add some money
  63.     float gold = ((plr->getLevel() / 2.5f) + 1.0f) * 100.0f;            // fix this later
  64.     gold *= sWorld.getRate(RATE_MONEY);
  65.  
  66.     // set it
  67.     TO< Corpse* >(pCorpse)->loot.gold = float2int32(gold);
  68. }
Advertisement
Add Comment
Please, Sign In to add comment