2020-08-23 17:14:54 +00:00
|
|
|
#pragma once
|
2020-08-21 02:10:14 +00:00
|
|
|
|
2021-03-17 19:07:40 +00:00
|
|
|
#include "servers/CNShardServer.hpp"
|
2020-08-28 16:25:03 +00:00
|
|
|
#include "Player.hpp"
|
2021-03-16 18:41:20 +00:00
|
|
|
#include "MobAI.hpp"
|
2021-04-04 10:45:57 +00:00
|
|
|
#include "Rand.hpp"
|
2020-08-21 02:10:14 +00:00
|
|
|
|
2020-09-16 00:30:01 +00:00
|
|
|
struct CrocPotEntry {
|
|
|
|
int multStats, multLooks;
|
|
|
|
float base, rd0, rd1, rd2, rd3;
|
|
|
|
};
|
2021-03-16 18:41:20 +00:00
|
|
|
|
functional crates (no more plungers) (#133)
* FM, Taros and Boosts awards from killing mobs should be pretty
accurate now. A temporary formula for adjusting player/mob level gap is
implemented, but it will probably need to be adjusted in the future
* Mobs now drop correct crates
* Crates can be opened and give you correct items This includes
regular mob crates, world boss crates, mission crates, IZ race crates,
E.G.G.E.R.s, golden Eggs, and Event Crates. Keep in mind that neither
IZ races or golden Eggs are implemented, but if you spawn such a crate
it can be opened.
* All data is read from a json file, for which I'm going to release a
tool soon so it's easily adjustable
* There is a new setting for enabling events, which enables dropping
extra event crates These are Knishmas, Halloween and Easter
2020-10-10 17:18:47 +00:00
|
|
|
struct Crate {
|
2021-03-30 02:48:31 +00:00
|
|
|
int itemSetId;
|
2021-03-28 20:57:43 +00:00
|
|
|
int rarityWeightId;
|
functional crates (no more plungers) (#133)
* FM, Taros and Boosts awards from killing mobs should be pretty
accurate now. A temporary formula for adjusting player/mob level gap is
implemented, but it will probably need to be adjusted in the future
* Mobs now drop correct crates
* Crates can be opened and give you correct items This includes
regular mob crates, world boss crates, mission crates, IZ race crates,
E.G.G.E.R.s, golden Eggs, and Event Crates. Keep in mind that neither
IZ races or golden Eggs are implemented, but if you spawn such a crate
it can be opened.
* All data is read from a json file, for which I'm going to release a
tool soon so it's easily adjustable
* There is a new setting for enabling events, which enables dropping
extra event crates These are Knishmas, Halloween and Easter
2020-10-10 17:18:47 +00:00
|
|
|
};
|
2020-09-13 22:54:47 +00:00
|
|
|
|
2021-03-28 20:57:43 +00:00
|
|
|
struct CrateDropChance {
|
|
|
|
int dropChance, dropChanceTotal;
|
2021-03-29 06:22:23 +00:00
|
|
|
std::vector<int> crateTypeDropWeights;
|
2021-03-28 20:57:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct MiscDropChance {
|
|
|
|
int potionDropChance, potionDropChanceTotal;
|
|
|
|
int boostDropChance, boostDropChanceTotal;
|
|
|
|
int taroDropChance, taroDropChanceTotal;
|
|
|
|
int fmDropChance, fmDropChanceTotal;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MiscDropType {
|
|
|
|
int potionAmount;
|
|
|
|
int boostAmount;
|
|
|
|
int taroAmount;
|
|
|
|
int fmAmount;
|
2021-03-16 18:41:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct MobDrop {
|
2021-03-28 20:57:43 +00:00
|
|
|
int crateDropChanceId;
|
|
|
|
int crateDropTypeId;
|
|
|
|
int miscDropChanceId;
|
|
|
|
int miscDropTypeId;
|
|
|
|
};
|
|
|
|
|
2021-03-30 02:48:31 +00:00
|
|
|
struct ItemSet {
|
|
|
|
// itemset-wise offswitch to rarity filtering, every crate drops every rarity (still based on rarity weights)
|
|
|
|
bool ignoreRarity;
|
|
|
|
// itemset-wise offswitch for gender filtering, every crate can now drop neutral/boys/girls items
|
2021-03-28 20:57:43 +00:00
|
|
|
bool ignoreGender;
|
2021-03-30 02:48:31 +00:00
|
|
|
// default weight of all items in the itemset
|
2021-03-28 20:57:43 +00:00
|
|
|
int defaultItemWeight;
|
2021-03-30 02:48:31 +00:00
|
|
|
// change the rarity class of items in the itemset here
|
|
|
|
// rarity 0 bypasses the rarity filter for an individual item
|
|
|
|
std::map<int, int> alterRarityMap;
|
|
|
|
// change the gender class of items in the itemset here
|
|
|
|
// gender 0 bypasses the gender filter for an individual item
|
|
|
|
std::map<int, int> alterGenderMap;
|
|
|
|
// change the item weghts items in the itemset here
|
|
|
|
// only taken into account for chosen rarity, and if the item isn't filtered away due to gender
|
|
|
|
std::map<int, int> alterItemWeightMap;
|
|
|
|
std::vector<int> itemReferenceIds;
|
2021-03-28 20:57:43 +00:00
|
|
|
};
|
|
|
|
|
2021-03-29 06:22:23 +00:00
|
|
|
struct ItemReference {
|
2021-03-28 20:57:43 +00:00
|
|
|
int itemId;
|
|
|
|
int type;
|
2021-03-29 06:22:23 +00:00
|
|
|
int rarity;
|
|
|
|
int gender;
|
2021-03-16 18:41:20 +00:00
|
|
|
};
|
|
|
|
|
2021-03-16 22:29:13 +00:00
|
|
|
namespace Items {
|
2020-09-14 13:20:55 +00:00
|
|
|
enum class SlotType {
|
|
|
|
EQUIP = 0,
|
|
|
|
INVENTORY = 1,
|
|
|
|
BANK = 3
|
2020-09-09 20:42:55 +00:00
|
|
|
};
|
2020-12-04 18:57:08 +00:00
|
|
|
struct Item {
|
|
|
|
bool tradeable, sellable;
|
2021-03-08 21:29:21 +00:00
|
|
|
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
|
|
|
};
|
2021-04-04 10:45:57 +00:00
|
|
|
struct DropRoll {
|
|
|
|
int boosts, potions;
|
|
|
|
int taros, fm;
|
|
|
|
int crate, crateType;
|
|
|
|
|
|
|
|
DropRoll() : boosts(Rand::rand()), potions(Rand::rand()), taros(Rand::rand()), fm(Rand::rand()), crate(Rand::rand()), crateType(Rand::rand()) { }
|
|
|
|
};
|
2020-09-13 22:54:47 +00:00
|
|
|
// hopefully this is fine since it's never modified after load
|
2020-09-14 04:25:14 +00:00
|
|
|
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
|
2021-03-28 20:57:43 +00:00
|
|
|
extern std::map<int32_t, std::vector<int32_t>> RarityWeights;
|
functional crates (no more plungers) (#133)
* FM, Taros and Boosts awards from killing mobs should be pretty
accurate now. A temporary formula for adjusting player/mob level gap is
implemented, but it will probably need to be adjusted in the future
* Mobs now drop correct crates
* Crates can be opened and give you correct items This includes
regular mob crates, world boss crates, mission crates, IZ race crates,
E.G.G.E.R.s, golden Eggs, and Event Crates. Keep in mind that neither
IZ races or golden Eggs are implemented, but if you spawn such a crate
it can be opened.
* All data is read from a json file, for which I'm going to release a
tool soon so it's easily adjustable
* There is a new setting for enabling events, which enables dropping
extra event crates These are Knishmas, Halloween and Easter
2020-10-10 17:18:47 +00:00
|
|
|
extern std::map<int32_t, Crate> Crates;
|
2021-03-29 06:22:23 +00:00
|
|
|
extern std::map<int32_t, ItemReference> ItemReferences;
|
2020-12-21 22:01:21 +00:00
|
|
|
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
|
|
|
|
2021-03-16 18:41:20 +00:00
|
|
|
// mob drops
|
2021-03-28 20:57:43 +00:00
|
|
|
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;
|
2021-03-16 18:41:20 +00:00
|
|
|
extern std::map<int32_t, MobDrop> MobDrops;
|
2021-04-04 10:45:57 +00:00
|
|
|
extern std::map<int32_t, int32_t> EventToDropMap;
|
2021-04-03 06:34:20 +00:00
|
|
|
extern std::map<int32_t, int32_t> MobToDropMap;
|
2021-03-30 02:48:31 +00:00
|
|
|
extern std::map<int32_t, ItemSet> ItemSets;
|
2021-03-16 18:41:20 +00:00
|
|
|
|
2020-10-05 00:03:13 +00:00
|
|
|
void init();
|
2020-08-28 16:25:03 +00:00
|
|
|
|
2021-03-16 18:41:20 +00:00
|
|
|
// mob drops
|
2021-04-04 10:45:57 +00:00
|
|
|
void giveMobDrop(CNSocket *sock, Mob *mob, const DropRoll& rolled, const DropRoll& eventRolled);
|
2021-03-16 18:41:20 +00:00
|
|
|
|
2020-08-28 16:25:03 +00:00
|
|
|
int findFreeSlot(Player *plr);
|
2020-09-14 14:27:52 +00:00
|
|
|
Item* getItemData(int32_t id, int32_t type);
|
2020-09-22 11:16:09 +00:00
|
|
|
void checkItemExpire(CNSocket* sock, Player* player);
|
2020-09-27 01:53:03 +00:00
|
|
|
void setItemStats(Player* plr);
|
2020-10-04 23:54:08 +00:00
|
|
|
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
|
2020-08-21 02:10:14 +00:00
|
|
|
}
|