dsgdssggss
unknown
c_cpp
a year ago
9.5 kB
2
Indexable
Never
void loop_cheat(ENetPeer* peer) { long long ms_time = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count(); try { if (autofarm_delay - ms_time <= 0) { autofarm_delay = ms_time + 300; for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) { if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL or pInfo(currentPeer)->world.empty() or pInfo(currentPeer)->tankIDName.empty()) continue; if (pInfo(currentPeer)->autofarm || pInfo(currentPeer)->autofarm2) { int playerx = pInfo(currentPeer)->x / 32 + (pInfo(currentPeer)->state == 16 ? -1 : 1); int playery = pInfo(currentPeer)->y / 32 + (pInfo(currentPeer)->y / 32 < pInfo(currentPeer)->y / 32 ? -1 : 1); int location = playerx / 32 + (playery / 32 * 100); string name_ = pInfo(currentPeer)->world; vector<World>::iterator p = find_if(worlds.begin(), worlds.end(), [name_](const World& a) { return a.name == name_; }); if (pInfo(currentPeer)->autofarm) { int block = pInfo(currentPeer)->farmable; int c_ = 0; modify_inventory(currentPeer, block, c_); if (p != worlds.end()) { World* world_ = &worlds[p - worlds.begin()]; WorldBlock* block_ = &world_->blocks[location]; if (block != 5640) { if (c_ <= 1) { pInfo(currentPeer)->autofarm = 0, pInfo(currentPeer)->farmable = 0; gamepacket_t ps; ps.Insert("OnConsoleMessage"); ps.Insert("`4Autofarm Stopped! `oYou don't have enough block to farm!"); ps.CreatePacket(peer); } if (block_->fg == 0 && block_->bg == 0) { if (pInfo(peer)->hand == 9770) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, block); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, block); } else if (pInfo(peer)->hand == 9846) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, block); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, block); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, block); } else if (pInfo(peer)->hand == 10362) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, block); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, block); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, block); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -4 : 4), pInfo(peer)->y / 32, block); } else { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, block); } } else { if (pInfo(peer)->hand == 9770) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, 18); } else if (pInfo(peer)->hand == 9846) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, 18); } else if (pInfo(peer)->hand == 10362) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -4 : 4), pInfo(peer)->y / 32, 18); } else { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); } } } else { for (int i_ = 0; i_ < world_->machines.size(); i_++) { WorldMachines machine = world_->machines[i_]; if (machine.x == pInfo(currentPeer)->magnetron_x and machine.y == pInfo(currentPeer)->magnetron_y and machine.id == 5638) { if (machine.enabled) { WorldBlock* itemas = &world_->blocks[machine.x + (machine.y * 100)]; if (itemas->magnetron and itemas->id == pInfo(currentPeer)->magnetron_id) { if (itemas->pr > 0) { if (block_->fg == 0 && block_->bg == 0) { if (pInfo(peer)->hand == 9770) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, itemas->id, true); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, itemas->id, true); } else if (pInfo(peer)->hand == 9846) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, itemas->id, true); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, itemas->id, true); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, itemas->id, true); } else if (pInfo(peer)->hand == 10362) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, itemas->id, true); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, itemas->id, true); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, itemas->id, true); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -4 : 4), pInfo(peer)->y / 32, itemas->id, true); } else { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, itemas->id, true); } itemas->pr--; if (itemas->pr <= 0) { PlayerMoving data_{}; data_.packetType = 5, data_.punchX = machine.x, data_.punchY = machine.y, data_.characterState = 0x8; BYTE* raw = packPlayerMoving(&data_, 112 + alloc_(world_, itemas)); BYTE* blc = raw + 56; form_visual(blc, *itemas, *world_, NULL, false); for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) { if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL) continue; if (pInfo(currentPeer)->world == world_->name) { send_raw(currentPeer, 4, raw, 112 + alloc_(world_, itemas), ENET_PACKET_FLAG_RELIABLE); } } delete[] raw, blc; } break; } else { if (pInfo(peer)->hand == 9770) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, 18); } else if (pInfo(peer)->hand == 9846) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, 18); } else if (pInfo(peer)->hand == 10362) { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -2 : 2), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -3 : 3), pInfo(peer)->y / 32, 18); edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -4 : 4), pInfo(peer)->y / 32, 18); } else { edit_tile(peer, pInfo(peer)->x / 32 + (pInfo(peer)->state == 16 ? -1 : 1), pInfo(peer)->y / 32, 18); } } } else { pInfo(currentPeer)->autofarm = 0, pInfo(currentPeer)->farmable = 0; gamepacket_t ps; ps.Insert("OnConsoleMessage"); ps.Insert("`4Autofarm Stopped! `oYou don't have enough block to farm!"); ps.CreatePacket(currentPeer); } } } } } } } } } else { continue; } } } } catch (out_of_range) { return; } }