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

Method AddEffect

src/Managers/EffectManager.cpp:16–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16void CEffectManager::AddEffect(CGameEffect *effect)
17{
18 switch (effect->EffectType)
19 {
20 case EF_MOVING:
21 case EF_STAY_AT_POS:
22 case EF_DRAG:
23 {
24 if (effect->EffectType == EF_MOVING)
25 {
26 CGameObject *obj = g_World->FindWorldObject(effect->DestSerial);
27 if (obj != nullptr)
28 {
29 obj = obj->GetTopObject();
30
31 if (obj != nullptr)
32 {
33 effect->DestX = obj->GetX();
34 effect->DestY = obj->GetY();
35 effect->DestZ = obj->GetZ();
36 }
37 }
38
39 CGameEffectMoving *moving = (CGameEffectMoving *)effect;
40
41 if (moving->GetX() == moving->DestX && moving->GetY() == moving->DestY &&
42 moving->GetZ() == moving->DestZ)
43 {
44 if (moving->Explode)
45 {
46 EFFECT_TYPE type = EF_STAY_AT_POS;
47
48 if (obj != nullptr)
49 {
50 type = EF_STAY_AT_SOURCE;
51 }
52
53 CreateExplodeEffect(moving, type);
54 }
55
56 delete effect;
57
58 return;
59 }
60 }
61
62 if (effect->EffectType != EF_STAY_AT_POS)
63 {
64 CGameEffectDrag *effectDrag = (CGameEffectDrag *)effect;
65 effectDrag->OffsetX = 0;
66 effectDrag->OffsetY = 0;
67 }
68
69 Add(effect);
70
71 g_MapManager.AddRender(effect);
72
73 effect->Update(nullptr);

Callers 1

PACKET_HANDLERFunction · 0.45

Calls 9

AddFunction · 0.85
FindWorldObjectMethod · 0.80
GetTopObjectMethod · 0.80
GetYMethod · 0.80
GetZMethod · 0.80
ExecuteGumpPartMethod · 0.80
GetXMethod · 0.45
AddRenderMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected