Advertisement
Guest User

Untitled

a guest
Feb 10th, 2021
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1. char __stdcall AdvMng_4_Arena(HiHook* hook, void* AvdMng, _Hero_* hero, _MapItem_* obj, bool isHuman)
  2. {
  3.     _AdvMgr_* AvdMan = (_AdvMgr_*)AvdMng;
  4.     char result = isHuman;
  5.     int SelectedSkill;
  6.  
  7.     bool isMagical = obj->os_type;
  8.  
  9.     if (!CALL_2(int, __thiscall, 0x4E5630, hero, obj)) //check if visited
  10.     {
  11.         if (isHuman)
  12.         {
  13.             CALL_3(int, __thiscall, 0x415CC0, AvdMan, 0, -1); //AdvMgr_SetTimer
  14.             CALL_4(void, __thiscall, 0x415D40, AvdMan, 0, 1, 1); //AdvMgr_UpdateInfoPanel
  15.  
  16.             if (!isMagical)
  17.                 b_MsgBoxQ(o_Advevent_TXT->GetString(0), 10, -1, -1, 31, 2, 32, 2, -1, 0, -1, 0);
  18.             else
  19.                 b_MsgBoxQ((char*)o_Advevent_2[0].c_str(), 10, -1, -1, 33, 2, 34, 2, -1, 0, -1, 0);
  20.  
  21.             if (o_WndMgr->result_dlg_item_id == 30729)
  22.             {
  23.                 SelectedSkill = 0;
  24.             }
  25.             else if (o_WndMgr->result_dlg_item_id == 30730)
  26.             {
  27.                 SelectedSkill = 1;
  28.             }
  29.             else
  30.                 return result;
  31.         }
  32.         else
  33.         {
  34.             if (isMagical)
  35.                 if (hero->power > hero->knowledge)
  36.                     if (hero->knowledge > 25 && hero->power < 99)
  37.                         SelectedSkill = 0;
  38.                     else
  39.                         SelectedSkill = 1;
  40.                 else //Проверка на переполнение не нужна, так как знания больше силы, а значит силе есть куда расти
  41.                     SelectedSkill = 0;
  42.             else
  43.                 if (hero->attack > hero->defence)
  44.                     SelectedSkill = 1;
  45.                 else
  46.                     SelectedSkill = 0;
  47.         }
  48.  
  49.         if (isMagical)
  50.             SelectedSkill += 2;
  51.  
  52.         switch (SelectedSkill)
  53.         {
  54.         case 0:
  55.             hero->attack += 2;
  56.             if (hero->attack > 99)
  57.                 hero->attack = 99;
  58.             break;
  59.         case 1:
  60.             hero->defence += 2;
  61.             if (hero->defence > 99)
  62.                 hero->defence = 99;
  63.             break;
  64.         case 2:
  65.             hero->power += 2;
  66.             if (hero->power > 99)
  67.                 hero->power = 99;
  68.             break;
  69.         case 3:
  70.             hero->knowledge += 2;
  71.             if (hero->knowledge > 99)
  72.                 hero->knowledge = 99;
  73.             break;
  74.         default:
  75.             break;
  76.         }
  77.         return CALL_2(int, __thiscall, 0x4E5650, hero, obj); //set as visited
  78.     }
  79.     if (isHuman)
  80.     {
  81.         if (!isMagical)
  82.             b_MsgBoxQ(o_Advevent_TXT->GetString(1), 1, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0);
  83.         else
  84.             b_MsgBoxQ((char*)o_Advevent_2[1].c_str(), 1, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0);
  85.         result = (o_WndMgr->result_dlg_item_id == DIID_OK);
  86.     }
  87.  
  88.     return result;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement