|
@@ -3,7 +3,10 @@
|
|
|
|
|
|
#include "itemdb.hpp"
|
|
|
|
|
|
+#include <chrono>
|
|
|
+#include <fstream>
|
|
|
#include <iostream>
|
|
|
+#include <map>
|
|
|
#include <stdlib.h>
|
|
|
#include <math.h>
|
|
|
#include <unordered_map>
|
|
@@ -4595,6 +4598,32 @@ int item_data::inventorySlotNeeded(int quantity)
|
|
|
return (this->flag.guid || !this->isStackable()) ? quantity : 1;
|
|
|
}
|
|
|
|
|
|
+void itemdb_gen_itemmoveinfo()
|
|
|
+{
|
|
|
+ ShowInfo("itemdb_gen_itemmoveinfo: Generating itemmoveinfov5.txt.\n");
|
|
|
+ auto starttime = std::chrono::system_clock::now();
|
|
|
+ auto os = std::ofstream("./generated/clientside/data/itemmoveinfov5.txt", std::ios::trunc);
|
|
|
+ std::map<t_itemid, std::shared_ptr<item_data>> sorted_itemdb(item_db.begin(), item_db.end());
|
|
|
+
|
|
|
+ os << "// ItemID,\tDrop,\tVending,\tStorage,\tCart,\tNpc Sale,\tMail,\tAuction,\tGuildStorage\n";
|
|
|
+ os << "// This format does not accept blank lines. Be careful.\n";
|
|
|
+
|
|
|
+ item_data tmp_id{};
|
|
|
+ for (auto it = sorted_itemdb.begin(); it != sorted_itemdb.end(); ++it) {
|
|
|
+ if (it->second->type == IT_UNKNOWN)
|
|
|
+ continue;
|
|
|
+ if (memcmp(&it->second->flag.trade_restriction, &tmp_id.flag.trade_restriction, sizeof(tmp_id.flag.trade_restriction)) == 0)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ os << it->first << "\t" << it->second->flag.trade_restriction.drop << "\t" << it->second->flag.trade_restriction.trade << "\t" << it->second->flag.trade_restriction.storage << "\t" << it->second->flag.trade_restriction.cart << "\t" << it->second->flag.trade_restriction.sell << "\t" << it->second->flag.trade_restriction.mail << "\t" << it->second->flag.trade_restriction.auction << "\t" << it->second->flag.trade_restriction.guild_storage << "\t// " << it->second->name << "\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ os.close();
|
|
|
+
|
|
|
+ auto currenttime = std::chrono::system_clock::now();
|
|
|
+ ShowInfo("itemdb_gen_itemmoveinfo: Done generating itemmoveinfov5.txt. The process took %lldms\n", std::chrono::duration_cast<std::chrono::milliseconds>(currenttime - starttime).count());
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Reload Item DB
|
|
|
*/
|