25 lines
1021 B
C
25 lines
1021 B
C
#pragma once
|
|
#include <stdint.h>
|
|
#pragma pack(push,1)
|
|
struct Ava2ShopRequest {
|
|
uint8_t operation; uint32_t account,player,product,count,expectedVnum; int64_t expectedTotal; char token[33],name[25],ip[16];
|
|
};
|
|
struct Ava2ShopReply { uint32_t account,player,size; };
|
|
struct Ava2ShopProduct {
|
|
uint32_t id,vnum; int64_t price; int32_t top; uint8_t discount;
|
|
int32_t expiry,added; int64_t sold; int32_t weekly,monthly,stock;
|
|
};
|
|
struct Ava2ShopLog {
|
|
uint32_t account; char name[25],date[21]; int32_t time; char ip[16];
|
|
uint32_t product,vnum; int32_t count; int64_t price;
|
|
};
|
|
#pragma pack(pop)
|
|
static_assert(sizeof(Ava2ShopRequest)==103,"itemshop request");
|
|
static_assert(sizeof(Ava2ShopProduct)==49,"native TIShopData");
|
|
static_assert(sizeof(Ava2ShopLog)==90,"native TIShopLogData");
|
|
|
|
inline bool Ava2ShopTotal(int64_t unit,uint32_t count,uint8_t discount,int64_t& total) {
|
|
if(unit<0 || unit>1000000000000LL || count<1 || count>20 || discount>100)return false;
|
|
total=unit*int64_t(count)*(100-discount)/100;return true;
|
|
}
|