OpenFusion/src/Items.hpp

107 lines
2.9 KiB
C++
Raw Normal View History

#pragma once
#include "servers/CNShardServer.hpp"
#include "Player.hpp"
#include "MobAI.hpp"
2020-09-16 00:30:01 +00:00
struct CrocPotEntry {
int multStats, multLooks;
float base, rd0, rd1, rd2, rd3;
};
struct Crate {
int itemSetChanceId;
int itemSetTypeId;
int rarityWeightId;
};
2020-09-13 22:54:47 +00:00
struct CrateDropChance {
int dropChance, dropChanceTotal;
2021-03-29 06:22:23 +00:00
std::vector<int> crateTypeDropWeights;
};
struct MiscDropChance {
int potionDropChance, potionDropChanceTotal;
int boostDropChance, boostDropChanceTotal;
int taroDropChance, taroDropChanceTotal;
int fmDropChance, fmDropChanceTotal;
};
struct MiscDropType {
int potionAmount;
int boostAmount;
int taroAmount;
int fmAmount;
};
struct MobDrop {
int crateDropChanceId;
int crateDropTypeId;
int miscDropChanceId;
int miscDropTypeId;
};
struct ItemSetType {
bool ignoreGender;
2021-03-29 06:22:23 +00:00
std::vector<int> itemReferenceIds;
};
struct ItemSetChance {
int defaultItemWeight;
2021-03-29 06:22:23 +00:00
std::map<int, int> indexWeightMap;
};
2021-03-29 06:22:23 +00:00
struct ItemReference {
int itemId;
int type;
2021-03-29 06:22:23 +00:00
int rarity;
int gender;
};
namespace Items {
enum class SlotType {
EQUIP = 0,
INVENTORY = 1,
BANK = 3
};
2020-12-04 18:57:08 +00:00
struct Item {
bool tradeable, sellable;
int buyPrice, sellPrice;
int stackSize, level, rarity;
int pointDamage, groupDamage, fireRate, defense, gender;
int weaponType;
// TODO: implement more as needed
2020-12-04 18:57:08 +00:00
};
2020-09-13 22:54:47 +00:00
// hopefully this is fine since it's never modified after load
extern std::map<std::pair<int32_t, int32_t>, Item> ItemData; // <id, type> -> data
2020-09-16 00:30:01 +00:00
extern std::map<int32_t, CrocPotEntry> CrocPotTable; // level gap -> entry
extern std::map<int32_t, std::vector<int32_t>> RarityWeights;
extern std::map<int32_t, Crate> Crates;
2021-03-29 06:22:23 +00:00
extern std::map<int32_t, ItemReference> ItemReferences;
extern std::map<std::string, std::vector<std::pair<int32_t, int32_t>>> CodeItems; // code -> vector of <id, type>
2020-09-13 22:54:47 +00:00
// mob drops
extern std::map<int32_t, CrateDropChance> CrateDropChances;
extern std::map<int32_t, std::vector<int32_t>> CrateDropTypes;
extern std::map<int32_t, MiscDropChance> MiscDropChances;
extern std::map<int32_t, MiscDropType> MiscDropTypes;
extern std::map<int32_t, MobDrop> MobDrops;
extern std::map<int32_t, ItemSetType> ItemSetTypes;
extern std::map<int32_t, ItemSetChance> ItemSetChances;
void init();
// mob drops
void giveMobDrop(CNSocket *sock, Mob *mob, int rolledBoosts, int rolledPotions, int rolledCrate, int rolledCrateType, int rolledEvent);
int findFreeSlot(Player *plr);
Item* getItemData(int32_t id, int32_t type);
void checkItemExpire(CNSocket* sock, Player* player);
void setItemStats(Player* plr);
void updateEquips(CNSocket* sock, Player* plr);
2020-12-16 15:27:18 +00:00
#ifdef ACADEMY
extern std::map<int32_t, int32_t> NanoCapsules; // crate id -> nano id
#endif
}