diff NPC.cpp @ 2380:56f87a5c402b

Merge
author Grumpy7
date Sat, 21 Jun 2014 00:42:34 +0200
parents 802460e60eee
children 8cee51ce4382
line wrap: on
line diff
--- a/NPC.cpp	Sat Jun 21 00:41:20 2014 +0200
+++ b/NPC.cpp	Sat Jun 21 00:42:34 2014 +0200
@@ -16,6 +16,9 @@
 #include "MapInfo.h"
 #include "Level/Decoration.h"
 #include "Actor.h"
+#include "AudioPlayer.h"
+#include "CastSpellInfo.h"
+#include "Overlays.h"
 
 int pDialogueNPCCount;
 std::array<struct Texture *, 6> pDialogueNPCPortraits;
@@ -1890,3 +1893,152 @@
   else
     return pNPCTopics[407].pTopic;
 }
+
+//----- (004BB756) --------------------------------------------------------
+int UseNPCSkill(NPCProf profession)
+{
+  switch (profession)
+  {
+    case Healer:
+    {
+      for (int i = 0; i < 4; ++i)
+        pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth();
+    }
+    break;
+
+    case ExpertHealer:
+    {
+      for (int i = 0; i < 4; ++i)
+      {
+        __debugbreak();
+        pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth();
+
+        for (int j = 0; j < 14; ++j)
+          pParty->pPlayers[i].pConditions[j] = 0;
+        pParty->pPlayers[i].pConditions[Condition_Good] = 0;
+      }
+    }
+    break;
+
+    case MasterHealer:
+    {
+      for (int i = 0; i < 4; ++i)
+      {
+        __debugbreak();	//Ritor1:needed cleaned(Необходимо почистить)
+        Player* player = &pParty->pPlayers[i];
+        pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth();
+
+        int v5 = LODWORD(player->pConditions[19]);//*((int *)v4 - 32);
+        int v6 = HIDWORD(player->pConditions[19]);//*((int *)v4 - 31);
+        memset(&pParty->pPlayers[i].pConditions, 0, sizeof(pParty->pPlayers[i].pConditions));
+
+        *(int *)&player->pActiveSkills[PLAYER_SKILL_SHIELD] = v5;
+        *(int *)&player->pActiveSkills[PLAYER_SKILL_CHAIN] = v6;
+      }
+    }
+    break;
+
+    case Cook://Повар
+    {
+      if (pParty->uNumFoodRations >= 13)
+        return 1;
+
+      Party::GiveFood(1);
+    }
+    break;
+
+    case Chef:
+    {
+      if (pParty->uNumFoodRations >= 13)
+        return 1;
+
+      if (pParty->uNumFoodRations == 13)
+        Party::GiveFood(1);
+      else
+        Party::GiveFood(2);
+    }
+    break;
+
+    case WindMaster:
+    {
+      if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+      {
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2);//Нельзя применить знание Полет в помещении!
+        pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0);
+      }
+      else
+      {
+        int v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536);
+        pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 60 * (256 * 2), 3, 1, v19, 0);
+        pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1;
+        pAudioPlayer->PlaySound(SOUND_11090, 0, 0, -1, 0, 0, 0, 0);
+      }
+    }
+    break;
+
+    case WaterMaster:
+    {
+      int v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
+      pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 60 * (256 * (2 + 1)), 3, 0, v20, 0);
+      pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1;
+      pAudioPlayer->PlaySound(SOUND_12040, 0, 0, -1, 0, 0, 0, 0);
+    }
+    break;
+
+    case GateMaster:
+    {
+      pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+      dword_50C9DC = 195;
+      ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
+    }
+    break;
+
+    case Acolyte:      _42777D_CastSpell_UseWand_ShootArrow(46, 0, 133, 0, 0); break;
+    case Piper:        _42777D_CastSpell_UseWand_ShootArrow(51, 0, 133, 0, 0); break;
+    case FallenWizard: _42777D_CastSpell_UseWand_ShootArrow(86, 0, 133, 0, 0); break;
+      
+    case Teacher:
+    case Instructor:
+    case Armsmaster:
+    case Weaponsmaster:
+    case Apprentice:
+    case Mystic:
+    case Spellmaster:
+    case Trader:
+    case Merchant:
+    case Scout:
+    case Herbalist:
+    case Apothecary:
+    case Tinker:
+    case Locksmith:
+    case Fool:
+    case ChimneySweep:
+    case Porter:
+    case QuarterMaster:
+    case Factor:
+    case Banker:
+    case Horseman:
+    case Bard:
+    case Enchanter:
+    case Cartographer:
+    case Explorer:
+    case Pirate:
+    case Squire:
+    case Psychic:
+    case Gypsy:
+    case Diplomat:
+    case Duper:
+    case Burglar:
+    case Acolyte2:
+    case Initiate:
+    case Prelate:
+    case Monk:
+    case Sage:
+    case Hunter:
+      break;
+
+    default:
+      assert(false && "Invalid enum value");
+  }
+  return 0;
+}
\ No newline at end of file