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

Method SendTargetObject

src/Target.cpp:105–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void CTarget::SendTargetObject(int serial)
106{
107 if (!Targeting)
108 {
109 return; //Если в клиенте нет таргета - выход
110 }
111
112 //Пишем серийник объекта, на который ткнули прицелом, остальное - затираем
113 pack32(m_Data + 7, serial);
114 m_Data[1] = 0;
115
116 CGameObject *obj = (g_World != nullptr ? g_World->FindWorldObject(serial) : nullptr);
117
118 if (obj != nullptr)
119 {
120 pack16(m_Data + 11, obj->GetX());
121 pack16(m_Data + 13, obj->GetY());
122 m_Data[15] = 0xFF;
123 m_Data[16] = obj->GetZ();
124 pack16(m_Data + 17, obj->Graphic);
125 }
126 else
127 {
128 pack32(m_Data + 11, 0);
129 pack32(m_Data + 15, 0);
130 }
131
132 if (serial != g_PlayerSerial)
133 {
134 g_LastTargetObject = serial;
135
136 //Скопируем для LastTarget
137 memcpy(m_LastData, m_Data, sizeof(m_Data));
138
139 if (obj != nullptr && obj->NPC && ((CGameCharacter *)obj)->MaxHits == 0)
140 {
141 CPacketStatusRequest(serial).Send();
142 }
143 }
144
145 SendTarget();
146}
147
148void CTarget::SendTargetTile(uint16_t tileID, short x, short y, char z)
149{

Callers 9

OnLeftMouseButtonUpMethod · 0.80
OnLeftMouseButtonUpMethod · 0.80
OnLeftMouseButtonDownMethod · 0.80
OnLeftMouseButtonUpMethod · 0.80
OnLeftMouseButtonUpMethod · 0.80
OnLeftMouseButtonUpMethod · 0.80
OnLeftMouseDownMethod · 0.80
PACKET_HANDLERFunction · 0.80
ProcessMethod · 0.80

Calls 9

pack32Function · 0.85
pack16Function · 0.85
memcpyFunction · 0.85
FindWorldObjectMethod · 0.80
GetYMethod · 0.80
GetZMethod · 0.80
GetXMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected