MCPcopy Create free account
hub / github.com/crossuo/crossuo / UpdateAbilities

Method UpdateAbilities

src/GameObjects/GamePlayer.cpp:48–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void CPlayer::UpdateAbilities()
49{
50 uint16_t equippedGraphic = 0;
51
52 CGameItem *layerObject = FindLayer(OL_1_HAND);
53
54 if (layerObject != nullptr)
55 {
56 equippedGraphic = layerObject->Graphic;
57 }
58 else
59 {
60 layerObject = FindLayer(OL_2_HAND);
61
62 if (layerObject != nullptr)
63 {
64 equippedGraphic = layerObject->Graphic;
65 }
66 }
67
68 g_Ability[0] = 0xFF;
69 g_Ability[1] = 0xFF;
70
71 if (equippedGraphic != 0u)
72 {
73 uint16_t graphics[2] = { equippedGraphic, 0 };
74 uint16_t imageID = layerObject->GetStaticData()->AnimID;
75 int count = 1;
76
77 uint16_t testGraphic = equippedGraphic - 1;
78
79 if (g_Data.m_Static[testGraphic].AnimID == imageID)
80 {
81 graphics[1] = testGraphic;
82 count = 2;
83 }
84 else
85 {
86 testGraphic = equippedGraphic + 1;
87
88 if (g_Data.m_Static[testGraphic].AnimID == imageID)
89 {
90 graphics[1] = testGraphic;
91 count = 2;
92 }
93 }
94
95 for (int i = 0; i < count; i++)
96 {
97 switch (graphics[i])
98 {
99 case 0x0901: // Gargish Cyclone
100 g_Ability[0] = AT_MOVING_SHOT;
101 g_Ability[1] = AT_INFUSED_THROW;
102 break;
103 case 0x0902: // Gargish Dagger
104 g_Ability[0] = AT_INFECTING;
105 g_Ability[1] = AT_SHADOW_STRIKE;

Callers 3

PrepareContentMethod · 0.80
PACKET_HANDLERFunction · 0.80
PacketManager.cppFile · 0.80

Calls 2

GetStaticDataMethod · 0.80
UpdateContentMethod · 0.45

Tested by

no test coverage detected