Guest User

Untitled

a guest
May 22nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 23.47 KB | None | 0 0
  1. diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
  2. index f81063b..32f30d1 100644
  3. --- a/src/game/GameObject.cpp
  4. +++ b/src/game/GameObject.cpp
  5. @@ -61,7 +61,6 @@ GameObject::GameObject() : WorldObject(),
  6.      m_captureTicks = (float)CAPTURE_SLIDER_NEUTRAL;
  7.      m_captureState = CAPTURE_STATE_NEUTRAL;
  8.      m_ownerFaction = TEAM_NONE;
  9. -    m_progressFaction = TEAM_NONE;
  10.      m_cooldownTime = 0;
  11.  
  12.      m_packedRotation = 0;
  13. @@ -209,44 +208,7 @@ void GameObject::Update(uint32 update_diff, uint32 diff)
  14.      {
  15.          if (m_captureTime < diff)
  16.          {
  17. -            GameObjectInfo const* info = this->GetGOInfo();
  18. -            if (!info)
  19. -                return;
  20. -
  21. -            float radius = info->capturePoint.radius;
  22. -            if (!radius)
  23. -                return;
  24. -
  25. -            // search for players in radius
  26. -            std::list<Player*> pointPlayers;
  27. -
  28. -            MaNGOS::AnyPlayerInObjectRangeCheck u_check(this, radius);
  29. -            MaNGOS::PlayerListSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> checker(pointPlayers, u_check);
  30. -            Cell::VisitWorldObjects(this, checker, radius);
  31. -
  32. -            // refill the player sets at every tick
  33. -            m_capturePlayers[BG_TEAM_ALLIANCE].clear();
  34. -            m_capturePlayers[BG_TEAM_HORDE].clear();
  35. -
  36. -            for (std::list<Player*>::iterator itr = pointPlayers.begin(); itr != pointPlayers.end(); ++itr)
  37. -            {
  38. -                if (!(*itr)->IsWorldPvPActive()) // TODO: Should stealthed/invisible/flying players also get quest objective complete if team member wins tower?
  39. -                    continue;
  40. -
  41. -                if (((Player*)(*itr))->GetTeam() == ALLIANCE)
  42. -                    m_capturePlayers[BG_TEAM_ALLIANCE].insert((*itr));
  43. -                else if (((Player*)(*itr))->GetTeam() == HORDE)
  44. -                    m_capturePlayers[BG_TEAM_HORDE].insert((*itr));
  45. -            }
  46. -
  47. -            // return if there are not enough players capturing the point
  48. -            if (m_capturePlayers[BG_TEAM_ALLIANCE].size() - m_capturePlayers[BG_TEAM_HORDE].size() == 0)
  49. -                return;
  50. -
  51. -            // if conditions are ok, then use the button
  52. -            // further checks and calculations will be done in the use function
  53. -            Use((*(pointPlayers.begin()))); // TODO: We actually now dont need player pointer in the Use() function of capture points
  54. -
  55. +            ProcessCapturePoint();
  56.              m_captureTime = 1000;
  57.          }
  58.          else
  59. @@ -1627,204 +1589,6 @@ void GameObject::Use(Unit* user)
  60.              }
  61.              break;
  62.          }
  63. -        case GAMEOBJECT_TYPE_CAPTURE_POINT:                 // 29
  64. -        {
  65. -            // Code here is not even halfway complete, and only added for further development.
  66. -            // Computer may very well blow up after stealing your bank accounts and wreck your car.
  67. -            // Use() object at own risk.
  68. -
  69. -            // the main ideea is that every use increases or decreases a counter
  70. -            // the slider can be updated by ticks
  71. -            // then we can check for the transition events (when counter = a value, trigger a certain event)
  72. -
  73. -            // Can we expect that only player object are able to trigger a capture point or
  74. -            // ToDo- research: could dummy creatures be involved?
  75. -
  76. -            //if (user->GetTypeId() != TYPEID_PLAYER)
  77. -            //    return;
  78. -
  79. -            GameObjectInfo const* info = GetGOInfo();
  80. -            if (!info)
  81. -                return;
  82. -
  83. -            // if the capture point is locked return
  84. -            if (sWorldPvPMgr.GetCapturePointLockState(GetEntry()))
  85. -                return;
  86. -
  87. -            // calculate the number of players which are actually capturing the point
  88. -            uint32 rangePlayers;
  89. -            if (m_capturePlayers[BG_TEAM_ALLIANCE].size() > m_capturePlayers[BG_TEAM_HORDE].size())
  90. -            {
  91. -                m_progressFaction = ALLIANCE;
  92. -                rangePlayers = m_capturePlayers[BG_TEAM_ALLIANCE].size() - m_capturePlayers[BG_TEAM_HORDE].size();
  93. -            }
  94. -            else
  95. -            {
  96. -                m_progressFaction = HORDE;
  97. -                rangePlayers = m_capturePlayers[BG_TEAM_HORDE].size() - m_capturePlayers[BG_TEAM_ALLIANCE].size();
  98. -            }
  99. -
  100. -            uint32 maxSuperiority = info->capturePoint.maxSuperiority;
  101. -            uint32 neutralPercent = info->capturePoint.neutralPercent;
  102. -            uint32 oldTicks = m_captureTicks;
  103. -
  104. -            // cap speed
  105. -            if (rangePlayers > maxSuperiority)
  106. -                rangePlayers = maxSuperiority;
  107. -
  108. -            // time to capture from 0% to 100% is minTime for maxSuperiority amount of players and maxTime for minSuperiority amount of players
  109. -            float diffTicks = 200.0f /
  110. -                (float)((maxSuperiority - rangePlayers) * (info->capturePoint.maxTime - info->capturePoint.minTime) /
  111. -                (float)(maxSuperiority - info->capturePoint.minSuperiority) + info->capturePoint.minTime);
  112. -
  113. -            if (m_progressFaction == ALLIANCE)
  114. -            {
  115. -                m_captureTicks += diffTicks;
  116. -                if (m_captureTicks > CAPTURE_SLIDER_ALLIANCE)
  117. -                    m_captureTicks = CAPTURE_SLIDER_ALLIANCE;
  118. -            }
  119. -            else
  120. -            {
  121. -                m_captureTicks -= diffTicks;
  122. -                if (m_captureTicks < CAPTURE_SLIDER_HORDE)
  123. -                    m_captureTicks = CAPTURE_SLIDER_HORDE;
  124. -            }
  125. -
  126. -            // send world state if integer of capture ticks change
  127. -            if (m_captureTicks != (float)oldTicks)
  128. -                for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
  129. -                    for (PlayerSet::iterator itr = m_capturePlayers[team].begin(); itr != m_capturePlayers[team].end(); ++itr)
  130. -                    {
  131. -                        (*itr)->SendUpdateWorldState(info->capturePoint.worldState1, 1);
  132. -                        (*itr)->SendUpdateWorldState(info->capturePoint.worldState2, (uint32)m_captureTicks);
  133. -                        (*itr)->SendUpdateWorldState(info->capturePoint.worldState3, neutralPercent);
  134. -                    }
  135. -
  136. -            // store the ticks value
  137. -            sWorldPvPMgr.SetCapturePointSlider(GetEntry(), m_captureTicks);
  138. -
  139. -            // ID1 vs ID2 are possibly related to team. The world states should probably
  140. -            // control which event to be used. For this to work, we need a far better system for
  141. -            // sWorldStateMgr (system to store and keep track of states) so that we at all times
  142. -            // know the state of every part of the world.
  143. -
  144. -            // Call every event, which is obviously wrong, but can help in further development. For
  145. -            // the time being script side can process events and determine which one to use. It
  146. -            // require of course that some object call go->Use()
  147. -            // win event can happen when a faction captures the tower with the slider at max range
  148. -
  149. -            uint32 eventId = 0;
  150. -
  151. -            // win event alliance
  152. -            // alliance wins tower with max points
  153. -            if ((uint32)m_captureTicks == CAPTURE_SLIDER_ALLIANCE && m_captureState == CAPTURE_STATE_PROGRESS)
  154. -            {
  155. -                if (info->capturePoint.winEventID1)
  156. -                    eventId = info->capturePoint.winEventID1;
  157. -
  158. -                m_captureState = CAPTURE_STATE_WIN;
  159. -            }
  160. -            // win event horde
  161. -            // horde wins a tower with max points
  162. -            else if ((uint32)m_captureTicks == CAPTURE_SLIDER_HORDE && m_captureState == CAPTURE_STATE_PROGRESS)
  163. -            {
  164. -                if (info->capturePoint.winEventID2)
  165. -                    eventId = info->capturePoint.winEventID2;
  166. -
  167. -                m_captureState = CAPTURE_STATE_WIN;
  168. -            }
  169. -
  170. -            // contest event can happen when a player succeeds in attacking a tower which belongs to the opposite faction; owner doesn't change
  171. -
  172. -            // contest event alliance
  173. -            // horde attack tower which is in progress or is won by alliance
  174. -            else if (m_ownerFaction == ALLIANCE && m_progressFaction == HORDE && m_captureState != CAPTURE_STATE_CONTEST && (m_captureState == CAPTURE_STATE_PROGRESS || m_captureState == CAPTURE_STATE_WIN))
  175. -            {
  176. -                if (info->capturePoint.contestedEventID1)
  177. -                    eventId = info->capturePoint.contestedEventID1;
  178. -
  179. -                m_captureState = CAPTURE_STATE_CONTEST;
  180. -            }
  181. -            // contest event horde
  182. -            // alliance attack tower which is in progress or is won by horde
  183. -            else if (m_ownerFaction == HORDE && m_progressFaction == ALLIANCE && m_captureState != CAPTURE_STATE_CONTEST && (m_captureState == CAPTURE_STATE_PROGRESS || m_captureState == CAPTURE_STATE_WIN))
  184. -            {
  185. -                if (info->capturePoint.contestedEventID2)
  186. -                    eventId = info->capturePoint.contestedEventID2;
  187. -
  188. -                m_captureState = CAPTURE_STATE_CONTEST;
  189. -            }
  190. -
  191. -            // the progress event can be achieved when a faction passes on its color on the slider or retakes the tower from a contested state
  192. -
  193. -            // progress event alliance
  194. -            // alliance takes the tower from neutral to alliance OR alliance takes the tower from contested to allaince
  195. -            else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL + neutralPercent * 0.5f + 1 && ((m_captureState == CAPTURE_STATE_NEUTRAL && m_progressFaction == ALLIANCE) || (m_captureState == CAPTURE_STATE_CONTEST && m_progressFaction == ALLIANCE)))
  196. -            {
  197. -                if (info->capturePoint.progressEventID1)
  198. -                    eventId = info->capturePoint.progressEventID1;
  199. -
  200. -                // handle objective complete
  201. -                if (m_captureState != CAPTURE_STATE_CONTEST)
  202. -                    sWorldPvPMgr.HandleObjectiveComplete(m_capturePlayers[BG_TEAM_ALLIANCE], info->capturePoint.progressEventID1);
  203. -
  204. -                // set capture state to alliance
  205. -                m_captureState = CAPTURE_STATE_PROGRESS;
  206. -                m_ownerFaction = ALLIANCE;
  207. -            }
  208. -            // progress event horde
  209. -            // horde takes the tower from neutral to horde OR horde takes the tower from contested to horde
  210. -            else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL - neutralPercent * 0.5f - 1 && ((m_captureState == CAPTURE_STATE_NEUTRAL && m_progressFaction == HORDE) || (m_captureState == CAPTURE_STATE_CONTEST && m_progressFaction == HORDE)))
  211. -            {
  212. -                if (info->capturePoint.progressEventID2)
  213. -                    eventId = info->capturePoint.progressEventID2;
  214. -
  215. -                // handle objective complete
  216. -                if (m_captureState != CAPTURE_STATE_CONTEST)
  217. -                    sWorldPvPMgr.HandleObjectiveComplete(m_capturePlayers[BG_TEAM_HORDE], info->capturePoint.progressEventID2);
  218. -
  219. -                // set capture state to horde
  220. -                m_captureState = CAPTURE_STATE_PROGRESS;
  221. -                m_ownerFaction = HORDE;
  222. -            }
  223. -
  224. -            // neutral event can happen when one faction takes the tower from the opposite faction and makes it neutral
  225. -
  226. -            // neutral event alliance
  227. -            // horde takes the tower from alliance to neutral
  228. -            else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL + neutralPercent * 0.5f && m_captureState == CAPTURE_STATE_CONTEST && m_progressFaction == HORDE)
  229. -            {
  230. -                if (info->capturePoint.neutralEventID1)
  231. -                    eventId = info->capturePoint.neutralEventID1;
  232. -
  233. -                m_captureState = CAPTURE_STATE_NEUTRAL;
  234. -                m_ownerFaction = TEAM_NONE;
  235. -            }
  236. -            // neutral event horde
  237. -            // alliance takes the tower from horde to neutral
  238. -            else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL - neutralPercent * 0.5f && m_captureState == CAPTURE_STATE_CONTEST && m_progressFaction == ALLIANCE)
  239. -            {
  240. -                if (info->capturePoint.neutralEventID2)
  241. -                    eventId = info->capturePoint.neutralEventID2;
  242. -
  243. -                m_captureState = CAPTURE_STATE_NEUTRAL;
  244. -                m_ownerFaction = TEAM_NONE;
  245. -           }
  246. -
  247. -           if (eventId)
  248. -           {
  249. -                // send zone script
  250. -                if (m_zoneScript)
  251. -                    m_zoneScript->ProcessEvent(this, eventId, m_progressFaction);
  252. -                // if zone script fails send to ScriptMgr
  253. -                // TODO: WHY?
  254. -                //else if (!sScriptMgr.OnProcessEvent(eventId, user, this, true))
  255. -                //    GetMap()->ScriptsStart(sEventScripts, eventId, user, this);
  256. -           }
  257. -
  258. -            // Some has spell, need to process those further.
  259. -            return;
  260. -        }
  261.          case GAMEOBJECT_TYPE_BARBER_CHAIR:                  // 32
  262.          {
  263.              GameObjectInfo const* info = GetGOInfo();
  264. @@ -1869,6 +1633,219 @@ void GameObject::Use(Unit* user)
  265.      spell->prepare(&targets);
  266.  }
  267.  
  268. +void GameObject::ProcessCapturePoint()
  269. +{
  270. +   GameObjectInfo const* info = this->GetGOInfo();
  271. +   if (!info)
  272. +       return;
  273. +
  274. +   float radius = info->capturePoint.radius;
  275. +   if (!radius)
  276. +       return;
  277. +
  278. +   // search for players in radius
  279. +   std::list<Player*> pointPlayers;
  280. +
  281. +   MaNGOS::AnyPlayerInObjectRangeCheck u_check(this, radius);
  282. +   MaNGOS::PlayerListSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> checker(pointPlayers, u_check);
  283. +   Cell::VisitWorldObjects(this, checker, radius);
  284. +
  285. +   PlayersSet m_capturePlayers[BG_TEAMS_COUNT];        // player sets for each faction // TODO: Use generic enum
  286. +   for (std::list<Player*>::iterator itr = pointPlayers.begin(); itr != pointPlayers.end(); ++itr)
  287. +   {
  288. +       if (!(*itr)->IsWorldPvPActive()) // TODO: Should stealthed/invisible/flying players also get quest objective complete if team member wins tower?
  289. +           continue;
  290. +
  291. +       if (((Player*)(*itr))->GetTeam() == ALLIANCE)
  292. +           m_capturePlayers[BG_TEAM_ALLIANCE].insert((*itr));
  293. +       else if (((Player*)(*itr))->GetTeam() == HORDE)
  294. +           m_capturePlayers[BG_TEAM_HORDE].insert((*itr));
  295. +   }
  296. +
  297. +   // return if there are not enough players capturing the point
  298. +   if (m_capturePlayers[BG_TEAM_ALLIANCE].size() - m_capturePlayers[BG_TEAM_HORDE].size() == 0)
  299. +       return;
  300. +
  301. +   // if the capture point is locked return
  302. +   if (sWorldPvPMgr.GetCapturePointLockState(GetEntry()))
  303. +       return;
  304. +
  305. +   uint32 rangePlayers;
  306. +   uint32 progressFaction; // faction which has the most players in range of a capture point
  307. +
  308. +   // calculate the number of players which are actually capturing the point
  309. +   if (m_capturePlayers[BG_TEAM_ALLIANCE].size() > m_capturePlayers[BG_TEAM_HORDE].size())
  310. +   {
  311. +       progressFaction = ALLIANCE;
  312. +       rangePlayers = m_capturePlayers[BG_TEAM_ALLIANCE].size() - m_capturePlayers[BG_TEAM_HORDE].size();
  313. +   }
  314. +   else
  315. +   {
  316. +       progressFaction = HORDE;
  317. +       rangePlayers = m_capturePlayers[BG_TEAM_HORDE].size() - m_capturePlayers[BG_TEAM_ALLIANCE].size();
  318. +   }
  319. +
  320. +   uint32 maxSuperiority = info->capturePoint.maxSuperiority;
  321. +   uint32 neutralPercent = info->capturePoint.neutralPercent;
  322. +   uint32 oldTicks = m_captureTicks;
  323. +
  324. +   // cap speed
  325. +   if (rangePlayers > maxSuperiority)
  326. +       rangePlayers = maxSuperiority;
  327. +
  328. +   // time to capture from 0% to 100% is minTime for maxSuperiority amount of players and maxTime for minSuperiority amount of players
  329. +   float diffTicks = 200.0f /
  330. +       (float)((maxSuperiority - rangePlayers) * (info->capturePoint.maxTime - info->capturePoint.minTime) /
  331. +       (float)(maxSuperiority - info->capturePoint.minSuperiority) + info->capturePoint.minTime);
  332. +
  333. +   if (progressFaction == ALLIANCE)
  334. +   {
  335. +       m_captureTicks += diffTicks;
  336. +       if (m_captureTicks > CAPTURE_SLIDER_ALLIANCE)
  337. +           m_captureTicks = CAPTURE_SLIDER_ALLIANCE;
  338. +   }
  339. +   else
  340. +   {
  341. +       m_captureTicks -= diffTicks;
  342. +       if (m_captureTicks < CAPTURE_SLIDER_HORDE)
  343. +           m_captureTicks = CAPTURE_SLIDER_HORDE;
  344. +   }
  345. +
  346. +   // send world state if integer of capture ticks change
  347. +   if (m_captureTicks != (float)oldTicks)
  348. +       for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
  349. +           for (PlayerSet::iterator itr = m_capturePlayers[team].begin(); itr != m_capturePlayers[team].end(); ++itr)
  350. +           {
  351. +               (*itr)->SendUpdateWorldState(info->capturePoint.worldState1, 1);
  352. +               (*itr)->SendUpdateWorldState(info->capturePoint.worldState2, (uint32)m_captureTicks);
  353. +               (*itr)->SendUpdateWorldState(info->capturePoint.worldState3, neutralPercent);
  354. +           }
  355. +
  356. +   // store the ticks value
  357. +   sWorldPvPMgr.SetCapturePointSlider(GetEntry(), m_captureTicks);
  358. +
  359. +   // ID1 vs ID2 are possibly related to team. The world states should probably
  360. +   // control which event to be used. For this to work, we need a far better system for
  361. +   // sWorldStateMgr (system to store and keep track of states) so that we at all times
  362. +   // know the state of every part of the world.
  363. +
  364. +   // Call every event, which is obviously wrong, but can help in further development. For
  365. +   // the time being script side can process events and determine which one to use. It
  366. +   // require of course that some object call go->Use()
  367. +   // win event can happen when a faction captures the tower with the slider at max range
  368. +
  369. +   uint32 eventId = 0;
  370. +
  371. +   // win event alliance
  372. +   // alliance wins tower with max points
  373. +   if ((uint32)m_captureTicks == CAPTURE_SLIDER_ALLIANCE && m_captureState == CAPTURE_STATE_PROGRESS)
  374. +   {
  375. +       if (info->capturePoint.winEventID1)
  376. +           eventId = info->capturePoint.winEventID1;
  377. +
  378. +       m_captureState = CAPTURE_STATE_WIN;
  379. +   }
  380. +   // win event horde
  381. +   // horde wins a tower with max points
  382. +   else if ((uint32)m_captureTicks == CAPTURE_SLIDER_HORDE && m_captureState == CAPTURE_STATE_PROGRESS)
  383. +   {
  384. +       if (info->capturePoint.winEventID2)
  385. +           eventId = info->capturePoint.winEventID2;
  386. +
  387. +       m_captureState = CAPTURE_STATE_WIN;
  388. +   }
  389. +
  390. +   // contest event can happen when a player succeeds in attacking a tower which belongs to the opposite faction; owner doesn't change
  391. +
  392. +   // contest event alliance
  393. +   // horde attack tower which is in progress or is won by alliance
  394. +   else if (m_ownerFaction == ALLIANCE && progressFaction == HORDE && m_captureState != CAPTURE_STATE_CONTEST && (m_captureState == CAPTURE_STATE_PROGRESS || m_captureState == CAPTURE_STATE_WIN))
  395. +   {
  396. +       if (info->capturePoint.contestedEventID1)
  397. +           eventId = info->capturePoint.contestedEventID1;
  398. +
  399. +       m_captureState = CAPTURE_STATE_CONTEST;
  400. +   }
  401. +   // contest event horde
  402. +   // alliance attack tower which is in progress or is won by horde
  403. +   else if (m_ownerFaction == HORDE && progressFaction == ALLIANCE && m_captureState != CAPTURE_STATE_CONTEST && (m_captureState == CAPTURE_STATE_PROGRESS || m_captureState == CAPTURE_STATE_WIN))
  404. +   {
  405. +       if (info->capturePoint.contestedEventID2)
  406. +           eventId = info->capturePoint.contestedEventID2;
  407. +
  408. +       m_captureState = CAPTURE_STATE_CONTEST;
  409. +   }
  410. +
  411. +   // the progress event can be achieved when a faction passes on its color on the slider or retakes the tower from a contested state
  412. +
  413. +   // progress event alliance
  414. +   // alliance takes the tower from neutral to alliance OR alliance takes the tower from contested to allaince
  415. +   else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL + neutralPercent * 0.5f + 1 && ((m_captureState == CAPTURE_STATE_NEUTRAL && progressFaction == ALLIANCE) || (m_captureState == CAPTURE_STATE_CONTEST && progressFaction == ALLIANCE)))
  416. +   {
  417. +       if (info->capturePoint.progressEventID1)
  418. +           eventId = info->capturePoint.progressEventID1;
  419. +
  420. +       // handle objective complete
  421. +       if (m_captureState != CAPTURE_STATE_CONTEST)
  422. +           sWorldPvPMgr.HandleObjectiveComplete(m_capturePlayers[BG_TEAM_ALLIANCE], info->capturePoint.progressEventID1);
  423. +
  424. +       // set capture state to alliance
  425. +       m_captureState = CAPTURE_STATE_PROGRESS;
  426. +       m_ownerFaction = ALLIANCE;
  427. +   }
  428. +   // progress event horde
  429. +   // horde takes the tower from neutral to horde OR horde takes the tower from contested to horde
  430. +   else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL - neutralPercent * 0.5f - 1 && ((m_captureState == CAPTURE_STATE_NEUTRAL && progressFaction == HORDE) || (m_captureState == CAPTURE_STATE_CONTEST && progressFaction == HORDE)))
  431. +   {
  432. +       if (info->capturePoint.progressEventID2)
  433. +           eventId = info->capturePoint.progressEventID2;
  434. +
  435. +       // handle objective complete
  436. +       if (m_captureState != CAPTURE_STATE_CONTEST)
  437. +           sWorldPvPMgr.HandleObjectiveComplete(m_capturePlayers[BG_TEAM_HORDE], info->capturePoint.progressEventID2);
  438. +
  439. +       // set capture state to horde
  440. +       m_captureState = CAPTURE_STATE_PROGRESS;
  441. +       m_ownerFaction = HORDE;
  442. +   }
  443. +
  444. +   // neutral event can happen when one faction takes the tower from the opposite faction and makes it neutral
  445. +
  446. +   // neutral event alliance
  447. +   // horde takes the tower from alliance to neutral
  448. +   else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL + neutralPercent * 0.5f && m_captureState == CAPTURE_STATE_CONTEST && progressFaction == HORDE)
  449. +   {
  450. +       if (info->capturePoint.neutralEventID1)
  451. +           eventId = info->capturePoint.neutralEventID1;
  452. +
  453. +       m_captureState = CAPTURE_STATE_NEUTRAL;
  454. +       m_ownerFaction = TEAM_NONE;
  455. +   }
  456. +   // neutral event horde
  457. +   // alliance takes the tower from horde to neutral
  458. +   else if ((uint32)m_captureTicks == CAPTURE_SLIDER_NEUTRAL - neutralPercent * 0.5f && m_captureState == CAPTURE_STATE_CONTEST && progressFaction == ALLIANCE)
  459. +   {
  460. +       if (info->capturePoint.neutralEventID2)
  461. +           eventId = info->capturePoint.neutralEventID2;
  462. +
  463. +       m_captureState = CAPTURE_STATE_NEUTRAL;
  464. +       m_ownerFaction = TEAM_NONE;
  465. +   }
  466. +
  467. +   if (eventId)
  468. +   {
  469. +       // send zone script
  470. +       if (m_zoneScript)
  471. +           m_zoneScript->ProcessEvent(this, eventId, progressFaction);
  472. +       // if zone script fails send to ScriptMgr
  473. +       // TODO: WHY?
  474. +       //else if (!sScriptMgr.OnProcessEvent(eventId, user, this, true))
  475. +       //    GetMap()->ScriptsStart(sEventScripts, eventId, user, this);
  476. +   }
  477. +
  478. +   // Some has spell, need to process those further.
  479. +}
  480. +
  481.  // overwrite WorldObject function for proper name localization
  482.  const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
  483.  {
  484. diff --git a/src/game/GameObject.h b/src/game/GameObject.h
  485. index 0ba2d2f..8cfc27f 100644
  486. --- a/src/game/GameObject.h
  487. +++ b/src/game/GameObject.h
  488. @@ -715,6 +715,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
  489.          float GetObjectBoundingRadius() const;              // overwrite WorldObject version
  490.  
  491.          void Use(Unit* user);
  492. +        void ProcessCapturePoint();
  493.  
  494.          LootState getLootState() const { return m_lootState; }
  495.          void SetLootState(LootState s) { m_lootState = s; }
  496. @@ -765,7 +766,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
  497.          uint32      m_captureTime;
  498.          float       m_captureTicks;
  499.          CapturePointState m_captureState;
  500. -        uint32      m_progressFaction;                      // faction which has the most players in range of a capture point
  501.          uint32      m_ownerFaction;                         // faction which has conquered the capture point
  502.          uint32      m_spellId;
  503.          time_t      m_respawnTime;                          // (secs) time of next respawn (or despawn if GO have owner()),
  504. @@ -778,8 +778,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
  505.          typedef std::set<ObjectGuid> GuidsSet;
  506.          typedef std::set<Player*> PlayersSet;
  507.  
  508. -        PlayersSet m_capturePlayers[BG_TEAMS_COUNT];        // player sets for each faction // TODO: Use generic enum
  509. -
  510.          GuidsSet m_SkillupSet;                              // players that already have skill-up at GO use
  511.  
  512.          uint32 m_useTimes;                                  // amount uses/charges triggered
Add Comment
Please, Sign In to add comment