static int findgraphic(int /*argc*/, char** argv) { int graphic = strtoul(argv[1], NULL, 0); INFO_PRINT << "Searching map for statics with graphic=0x" << fmt::hexu(graphic) << "\n"; Core::open_uo_data_files(); Core::read_uo_data(); for (u16 y = 0; y < 4095; ++y) { for (u16 x = 0; x < 6143; ++x) { Core::StaticList statics; readallstatics(statics, x, y); for (const auto& rec : statics) { if (rec.graphic == graphic) { INFO_PRINT << x << "," << y << "," << rec.z << "\n"; } } } } Core::clear_tiledata(); return 0; }
int findgraphic( int argc, char **argv ) { int graphic = strtoul( argv[1], NULL, 0 ); cout << "Searching map for statics with graphic=" << hexint(graphic) << endl; open_uo_data_files(); read_uo_data(); for( u16 y = 0; y < 4095; ++y ) { for( u16 x = 0; x < 6143; ++x ) { StaticList statics; readallstatics( statics, x, y ); for( unsigned i = 0; i < statics.size(); ++i ) { StaticRec& rec = statics[i]; if (rec.graphic == graphic) { cout << x << "," << y << "," << rec.z << endl; } } } } clear_tiledata(); return 0; }
int print_statics() { cout << "Reading UO data.." << endl; open_uo_data_files(); read_uo_data(); long water = 0; long strange_water = 0; long cnt = 0; for( u16 y = 30; y < 50; y++ ) { for( u16 x = 5900; x < 5940; x++ ) { std::vector<StaticRec> vec; readallstatics( vec, x, y ); bool hdrshown = false; if (!vec.empty()) { for( std::vector<StaticRec>::iterator itr = vec.begin(); itr != vec.end(); ++itr ) { int height = tileheight( (*itr).graphic ); if ((*itr).graphic >= 0x1796 && (*itr).graphic <= 0x17b2) { if ( (*itr).z == -5 && height == 0 ) water++; else strange_water++; continue; } if (!hdrshown) cout << x << "," << y << ":" << endl; hdrshown = true; cout << "\tOBJT= 0x" << hex << (*itr).graphic << dec << " Z=" << int( (*itr).z ) << " HT=" << height << " FLAGS=" << hex << tile_uoflags( (*itr).graphic ) << dec << endl; ++cnt; } } } } cout << cnt << " statics exist." << endl; cout << water << " water tiles exist." << endl; cout << strange_water << " strange water tiles exist." << endl; clear_tiledata(); return 0; }
static int mapdump(int argc, char* argv[]) { u16 wxl = 5485, wxh = 5500, wyl = 0, wyh = 30; if (argc >= 4) { wxl = wxh = static_cast<u16>(atoi(argv[2])); wyl = wyh = static_cast<u16>(atoi(argv[3])); } if (argc >= 6) { wxh = static_cast<u16>(atoi(argv[4])); wyh = static_cast<u16>(atoi(argv[5])); } Core::open_uo_data_files(); Core::read_uo_data(); std::ofstream ofs("mapdump.html"); ofs << "<table border=1 cellpadding=5 cellspacing=0>" << std::endl; ofs << "<tr><td> </td>"; for (u16 x = wxl; x <= wxh; ++x) { ofs << "<td align=center>" << x << "</td>"; } ofs << "</tr>" << std::endl; for (u16 y = wyl; y <= wyh; ++y) { ofs << "<tr><td valign=center>" << y << "</td>" << std::endl; for (u16 x = wxl; x <= wxh; ++x) { ofs << "<td align=left valign=top>"; short z; Core::USTRUCT_MAPINFO mi; safe_getmapinfo(x, y, &z, &mi); Core::USTRUCT_LAND_TILE landtile; readlandtile(mi.landtile, &landtile); ofs << "z=" << z << "<br>"; ofs << "landtile=" << Clib::hexint(mi.landtile) << " " << landtile.name << "<br>"; ofs << " flags=" << Clib::hexint(landtile.flags) << "<br>"; ofs << "mapz=" << (int) mi.z << "<br>"; Core::StaticList statics; readallstatics(statics, x, y); if (!statics.empty()) { ofs << "<table border=1 cellpadding=5 cellspacing=0>" << std::endl; ofs << "<tr><td>graphic</td><td>z</td><td>flags</td><td>ht</td>" << std::endl; for (const auto& rec : statics) { ofs << "<tr>"; ofs << "<td>" << Clib::hexint(rec.graphic) << "</td>"; ofs << "<td>" << int(rec.z) << "</td>"; ofs << "<td>" << Clib::hexint(rec.flags) << "</td>"; ofs << "<td>" << int(rec.height) << "</td>"; ofs << "</tr>" << std::endl; } ofs << "</table>" << std::endl; } ofs << "</td>" << std::endl; } ofs << "</tr>" << std::endl; } ofs << "</table>" << std::endl; Core::clear_tiledata(); return 0; }