- S1: Chinese locale pack, target HP/drop preview, elemental icons, exchange level display, item highlight, FOV settings, advanced skybox, GM warp. - S2: 5-page 225-slot inventory, seamless channel switch, wiki/drop query/chest preview. - S3: Auto-refine/attribute locks, sash combine/absorb, talisman/elemental stats, costume/mount/shining slots, changelook, soulbind, glove, quiver, magic reduction. - S4: Modern cube renewal, mythic dragon soul (6 grades/1152 slots), DS attr change, global rankings, dice system. - S5: Multi-token shop, offline private shop search, offline shop state machine, 64-bit gold alignment, Won dual currency exchange. - S6: Single account 5-character slot adaptive wire protocol, Wolfman profession & claw weapon/applies, Conqueror level & Sungma attributes, pets & 6th/7th attrs, battle pass & boss tracking. - Pass 42/42 platform gate test suites in scripts/port_gate.sh macos.
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#include <cstdint>
|
|
#include <ctime>
|
|
using BYTE=uint8_t;using DWORD=uint32_t;
|
|
constexpr int OFFLINE_SHOP_HOST_ITEM_MAX_NUM=80;
|
|
enum{CHAT_TYPE_INFO,SHOP_SUBHEADER_GC_SOLD_OUT,SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY};
|
|
struct Character {bool CanBuyItemOfflineShop(){return false;}template<class... T>void ChatPacket(T...){}DWORD GetPlayerID(){return 2;}int64_t GetGold(){return 1000;}};using LPCHARACTER=Character*;
|
|
struct OFFLINE_SHOP_ITEM{DWORD owner_id=1;int status=0;int64_t price=1;};
|
|
struct Shop{struct Data{time_t time=::time(0)+3600;OFFLINE_SHOP_ITEM items[80];}m_data;};using LPOFFLINESHOP=Shop*;
|
|
Shop shop;Shop* FindOfflineShopPID(DWORD){return &shop;}void SendReturnPacket(LPCHARACTER,int){}
|
|
void Buy(LPCHARACTER ch, DWORD vid, BYTE pos)
|
|
{
|
|
if(!ch)
|
|
return;
|
|
if (ch->CanBuyItemOfflineShop())
|
|
return;
|
|
|
|
LPOFFLINESHOP pkOfflineShop = FindOfflineShopPID(vid);
|
|
if (!pkOfflineShop)
|
|
{
|
|
ch->ChatPacket(CHAT_TYPE_INFO, "867");
|
|
return;
|
|
}
|
|
|
|
if (time(0) > pkOfflineShop->m_data.time)
|
|
{
|
|
ch->ChatPacket(CHAT_TYPE_INFO, "975");
|
|
return;
|
|
}
|
|
|
|
OFFLINE_SHOP_ITEM& item = pkOfflineShop->m_data.items[pos];
|
|
if (item.owner_id == ch->GetPlayerID()){
|
|
//ch->ChatPacket(CHAT_TYPE_INFO, "You can't buy your own shop!");
|
|
return;
|
|
}
|
|
else if (item.status != 0){
|
|
SendReturnPacket(ch, SHOP_SUBHEADER_GC_SOLD_OUT);
|
|
return;
|
|
}
|
|
if (ch->GetGold() < item.price) {
|
|
SendReturnPacket(ch, SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY);
|
|
return;
|
|
}
|
|
|
|
|
|
}
|
|
int main(){Character ch;Buy(&ch,1,80);}
|