Advertisement
VegaS1234

[C++] Shit Boss Library

May 29th, 2017
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.87 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "constants.h"
  3. #include "char.h"
  4. #include "item.h"
  5. #include "item_manager.h"
  6. #include "mob_manager.h"
  7. #include <algorithm>
  8.  
  9. struct SBossDataManager
  10. {
  11.     unsigned short  mobVnum;
  12.     unsigned short  type;
  13.     unsigned short  itemVnum;
  14.     unsigned short  itemCount;
  15.     bool    isNotice;
  16. };
  17.  
  18. #define BOSS_LIST_MAX_NUM 10
  19. SBossDataManager sObjects[BOSS_LIST_MAX_NUM] =
  20. {
  21.     {   591,        1,      27001,      10,     true    },
  22.     {   691,        1,      70003,      35,     false   },
  23.     {   792,        1,      70005,      25,     true    },
  24.     {   1304,       1,      80014,      50,     true    },
  25.     {   1901,       1,      80015,      100,    true    },
  26.     {   2091,       1,      80016,      45,     false   },
  27.     {   2191,       1,      71123,      200,    true    },
  28.     {   2206,       1,      71129,      200,    true    },
  29.     {   2306,       1,      50011,      100,    false   },
  30.     {   5161,       1,      71107,      100,    true    }
  31.     // Customizable
  32. };
  33.  
  34. void OnKillBoss(LPCHARACTER ch, LPCHARACTER pkVictim)
  35. {
  36.     if (!ch || !pkVictim || !ch->IsPC() || ch->IsGM() || pkVictim->IsPC())
  37.         return;
  38.    
  39.     const CMob * pkMob;
  40.     unsigned short mobVnum, itemVnum, itemCount;
  41.  
  42.     for (int i = 0; i < BOSS_LIST_MAX_NUM; i++)
  43.     {
  44.         mobVnum = sObjects[i].mobVnum;
  45.         itemVnum = sObjects[i].itemVnum;
  46.         itemCount = sObjects[i].itemCount;
  47.  
  48.         if (!CMobManager::instance().Get(vnum))
  49.             return;
  50.  
  51.         if (mobVnum == pkVictim->GetMobTable().dwVnum)
  52.         {
  53.             if (sObjects[i].isNotice)
  54.                 SendNoticeNew("[Boss-Kill Notice]: %s has slain %s on channel %d.", ch->GetName(), pkVictim->GetMobTable().szLocaleName, g_bChannel);  
  55.  
  56.             if (!ITEM_MANAGER::instance().GetTable(itemVnum))
  57.                 return;
  58.            
  59.             ch->AutoGiveItem(itemVnum, itemCount);
  60.             break;
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement