Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
7.1 kB
4
Indexable
Never
// source.cpp case 0

if (pInfo(peer)->autofarm || pInfo(peer)->autofarm2) loop_cheat();
							
// source.cpp void loop_worlds üstü

long long int autofarm_delay = 0;
void loop_cheat() {
	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) {
						edit_tile(currentPeer, pInfo(currentPeer)->x / 32 + (pInfo(currentPeer)->state == 16 ? -1 : 1), pInfo(currentPeer)->y / 32, 18);
						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(currentPeer);
								}
								if (block_->fg == 0 && block_->bg == 0) {
									edit_tile(currentPeer, pInfo(currentPeer)->x / 32 + (pInfo(currentPeer)->state == 16 ? -1 : 1), pInfo(currentPeer)->y / 32, block);
								}
								else {
									edit_tile(currentPeer, pInfo(currentPeer)->x / 32 + (pInfo(currentPeer)->state == 16 ? -1 : 1), pInfo(currentPeer)->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) {
														edit_tile(currentPeer, pInfo(currentPeer)->x / 32 + (pInfo(currentPeer)->state == 16 ? -1 : 1), pInfo(currentPeer)->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 {
														edit_tile(currentPeer, pInfo(currentPeer)->x / 32 + (pInfo(currentPeer)->state == 16 ? -1 : 1), pInfo(currentPeer)->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;
	}
}


// source.cpp autofarm buton

if (cch.find("action|dialog_return\ndialog_name|cheats_1_1\nauto_farming_item|") != std::string::npos) {
								vector<string> t_ = explode("|", cch);
								if (t_.size() < 4) break;
								int anan = atoi(explode("\n", t_[3])[0].c_str());
								if (items[anan].blockType != FOREGROUND && anan != 5640) {
									gamepacket_t k;
									k.Insert("OnConsoleMessage");
									k.Insert("`4Error! You can farm only blocks!");
									break;
								}
								else {
									pInfo(peer)->farmable = atoi(explode("\n", t_[3])[0].c_str());
									autodialog(peer);
								}
								break;
							}
							if (cch.find("action|dialog_return\ndialog_name|cheats_1_1\nbuttonClicked|closeauto") != std::string::npos) {
								pInfo(peer)->autofarm = 0, pInfo(peer)->autofarm2 = 0;
								break;
							}
else if (cch.find("action|dialog_return\ndialog_name|cheats_1_1") != string::npos) {
								
								pInfo(peer)->autofarm = atoi(explode("\n", explode("nocip_1_1|", cch)[1])[0].c_str()); //Auto Farm
						
								if (pInfo(peer)->autofarm2 && pInfo(peer)->autofarm) {
									gamepacket_t p;
									p.Insert("OnDialogRequest");
									p.Insert("`4Error!`o You can only choose one thing!");
									p.CreatePacket(peer);
									pInfo(peer)->autofarm = 0, pInfo(peer)->autofarm2 = 0;
									break;
								}
							}
						

// world.h

void autodialog(ENetPeer* p_) {
	gamepacket_t p;
	p.Insert("OnDialogRequest");
	p.Insert("set_default_color|`o\nadd_label_with_icon|big|`wAutofarm Menu|left|7064|\n"
		"add_spacer|small|\n"
		"add_label_with_icon|small|`2Current Block: `w" + items[pInfo(p_)->farmable].name + "|left|" + to_string(pInfo(p_)->farmable) + "|\n"
		"add_spacer|small|\n"
		"add_item_picker|auto_farming_item|`wChoose Autofarm Block``|Choose an item you want to auto farm!|\n"
		"add_spacer|small|\n"
		"add_checkbox|nocip_1_1|Start Autofarming|" + (string(pInfo(p_)->autofarm ? "1" : "0")) + "\n"
		"add_button|closeauto|Restore defaults|noflags|0|0|\n"
		"add_smalltext|`oSelect Remote as block for doing autofarm with magplant!|\n"
		"add_spacer|small|\n"
		"end_dialog|cheats_1_1|Cancel|Apply|");
	p.CreatePacket(p_);
}

//world.h ctrl + f else if (a_[i_] == "popup")

else if (a_.size() == 8 and a_[5] == "autofarm") {
				autodialog(p_);
			} // autofarmi wrenchselfteki yere bagladik boyle yaparak, wrenchself dialoguna autofarm isimli buton ekle

// PlayerInfo (int auth, save_player ve player.h tanımla)

int autofarm 
int autofarm2
int farmable