Advertisement
masodikbela

OnHit questTrigger

May 16th, 2016
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.70 KB | None | 0 0
  1. char_battle.cpp:
  2.  
  3. Under this:
  4. bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // returns true if dead
  5. {
  6.  
  7. insert this:
  8.     if (pAttacker && pAttacker->IsPC() && !IsDead())
  9.     {
  10.         pAttacker->SetQuestNPCID(GetVID());
  11.         quest::CQuestManager::instance().Hit(pAttacker->GetPlayerID(), IsPC() ? GetPlayerID() : GetRaceNum(), IsPC());
  12.     }
  13.  
  14. questmanager.cpp:
  15. under this:
  16.         m_mapEventName.insert(TEventNameMap::value_type("item_informer", QUEST_ITEM_INFORMER_EVENT));
  17.  
  18. insert this:
  19.         m_mapEventName.insert(TEventNameMap::value_type("hit", QUEST_HIT_EVENT));
  20.  
  21. before this:
  22.     bool CQuestManager::ServerTimer(unsigned int npc, unsigned int arg)
  23.     {
  24.  
  25. insert this:
  26.     void CQuestManager::Hit(unsigned int pc, unsigned int npc, bool isPC)
  27.     {
  28.         PC * pPC;
  29.  
  30.         //sys_log(0, "CQuestManager::HIT QUEST_HIT_EVENT (pc=%d, npc=%d, isPC=%s)", pc, npc, isPC? "Y": "N");
  31.  
  32.         if ((pPC = GetPC(pc)))
  33.         {
  34.             if (!CheckQuestLoaded(pPC))
  35.                 return;
  36.  
  37.             if (npc > 0 && !isPC)
  38.                 m_mapNPC[npc].OnHit(*pPC);
  39.  
  40.             m_mapNPC[QUEST_NO_NPC].OnHit(*pPC);
  41.         }
  42.         else
  43.             sys_err("QUEST: no such pc id : %d", pc);
  44.     }
  45.  
  46. questnpc.cpp:
  47. before this:
  48.     bool NPC::OnPartyKill(PC & pc)
  49.     {
  50.  
  51. insert this:
  52.     bool NPC::OnHit(PC & pc)
  53.     {
  54.         if (m_vnum)
  55.             return HandleEvent(pc, QUEST_HIT_EVENT);
  56.         else
  57.             return HandleReceiveAllEvent(pc, QUEST_HIT_EVENT);
  58.     }
  59.  
  60. questnpc.h:
  61. after this:
  62.             bool    OnKill(PC& pc);
  63.  
  64. insert this:
  65.             bool    OnHit(PC& pc);
  66.  
  67. questmanager.h:
  68. after this:
  69.             void        Kill(unsigned int pc, unsigned int npc, unsigned int pc2 = 0);
  70.  
  71. insert this:
  72.             void        Hit(unsigned int pc, unsigned int npc, bool isPC = false);
  73.  
  74. quest.h
  75. after this:
  76.         QUEST_ITEM_INFORMER_EVENT,
  77.  
  78. insert this:
  79.         QUEST_HIT_EVENT,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement