2020-08-23 17:14:54 +00:00
|
|
|
#pragma once
|
2020-08-21 02:10:14 +00:00
|
|
|
|
|
|
|
#include "CNShardServer.hpp"
|
2020-08-28 16:25:03 +00:00
|
|
|
#include "Player.hpp"
|
2020-08-21 02:10:14 +00:00
|
|
|
|
2020-09-13 22:54:47 +00:00
|
|
|
struct VendorListing {
|
2020-09-14 04:25:14 +00:00
|
|
|
int sort, type, iID;
|
2020-09-13 22:54:47 +00:00
|
|
|
};
|
2020-09-16 00:30:01 +00:00
|
|
|
struct CrocPotEntry {
|
|
|
|
int multStats, multLooks;
|
|
|
|
float base, rd0, rd1, rd2, rd3;
|
|
|
|
};
|
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 {
|
|
|
|
int rarityRatioId;
|
|
|
|
std::vector<int> itemSets;
|
|
|
|
};
|
2020-09-13 22:54:47 +00:00
|
|
|
|
2020-08-21 02:10:14 +00:00
|
|
|
namespace ItemManager {
|
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;
|
|
|
|
int buyPrice, sellPrice, stackSize, level, rarity, pointDamage, groupDamage, defense, gender; // TODO: implement more as needed
|
|
|
|
};
|
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-13 22:54:47 +00:00
|
|
|
extern std::map<int32_t, std::vector<VendorListing>> VendorTables;
|
2020-09-16 00:30:01 +00:00
|
|
|
extern std::map<int32_t, CrocPotEntry> CrocPotTable; // level gap -> entry
|
2020-10-17 23:19:05 +00:00
|
|
|
extern std::map<int32_t, std::vector<int>> RarityRatios;
|
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;
|
|
|
|
// pair <Itemset, Rarity> -> vector of pointers (map iterators) to records in ItemData (it looks a lot scarier than it is)
|
2020-10-17 23:19:05 +00:00
|
|
|
extern std::map<std::pair<int32_t, int32_t>,
|
|
|
|
std::vector<std::map<std::pair<int32_t, int32_t>, Item>::iterator>> CrateItems;
|
2020-09-13 22:54:47 +00:00
|
|
|
|
2020-10-05 00:03:13 +00:00
|
|
|
void init();
|
2020-08-28 16:25:03 +00:00
|
|
|
|
2020-09-14 13:53:48 +00:00
|
|
|
void itemMoveHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemDeleteHandler(CNSocket* sock, CNPacketData* data);
|
2020-08-21 20:09:52 +00:00
|
|
|
void itemGMGiveHandler(CNSocket* sock, CNPacketData* data);
|
2020-09-25 05:35:27 +00:00
|
|
|
void itemUseHandler(CNSocket* sock, CNPacketData* data);
|
2020-09-14 14:03:30 +00:00
|
|
|
// Bank
|
2020-09-09 20:42:55 +00:00
|
|
|
void itemBankOpenHandler(CNSocket* sock, CNPacketData* data);
|
2020-08-26 17:40:10 +00:00
|
|
|
void itemTradeOfferHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemTradeOfferAcceptHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemTradeOfferRefusalHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemTradeConfirmHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemTradeConfirmCancelHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemTradeRegisterItemHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemTradeUnregisterItemHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void itemTradeRegisterCashHandler(CNSocket* sock, CNPacketData* data);
|
2020-08-27 02:35:13 +00:00
|
|
|
void itemTradeChatHandler(CNSocket* sock, CNPacketData* data);
|
2020-08-28 16:25:03 +00:00
|
|
|
void chestOpenHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
|
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
|
|
|
// crate opening logic with all helper functions
|
2020-10-17 23:19:05 +00:00
|
|
|
int getItemSetId(Crate& crate, int crateId);
|
|
|
|
int getRarity(Crate& crate, int itemSetId);
|
|
|
|
int getCrateItem(sItemBase& reward, int itemSetId, int rarity, int playerGender);
|
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-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-08-21 02:10:14 +00:00
|
|
|
}
|