feat: add account point rewards and extended item storage

Implement configurable kill rewards with account-wide daily limits, transactional deduplication, and game-to-db retries. Add the approved wide rules and tested isolation tooling.

Stage wear40 equipment and persistent extra item metadata with an explicit migration plan and client revision gate. Track all 168 remaining offers; sixteen have staged data/assets, while live acceptance and other systems remain incomplete. This commit is not a production deployment.
This commit is contained in:
shen
2026-10-19 18:30:19 -07:00
parent 275c7e5211
commit 65db9fc365
31 changed files with 1965 additions and 26 deletions
+7
View File
@@ -78,8 +78,12 @@ enum EItemTypes
ITEM_BELT, //34 벨트
ITEM_SHINING, //35 AVA2 shining (not ported, keeps the AVA2 numbering)
ITEM_NEW_RINGS, //36 AVA2 new rings (port_rings.cpp), worn in WEAR_RINGS_1/2
ITEM_PET, // PORT: AVA2 growable pets, explicit item type 37.
};
enum EPetSubTypes { PET_LEVELABLE, PET_EGG, PET_TRANSPORTBOX, PET_PROTEIN, PET_CHANGE_NAME_ITEM, PET_DEW, PET_SKILL, PET_PRIMIUM_FEEDSTUFF, PET_ATTR_CHANGE, PET_ATTR_DETERMINE, PET_EXPFOOD_PER, PET_SKILL_DEL_BOOK, PET_SKILL_ALL_DEL_BOOK, PET_EXPFOOD, PET_FEEDSTUFF };
enum EShiningSubTypes { SHINING_WEAPON, SHINING_ARMOR, SHINING_SPECIAL };
enum EMetinSubTypes
{
METIN_NORMAL,
@@ -119,6 +123,9 @@ enum ECostumeSubTypes
COSTUME_MOUNT = 2, // AVA2 mount costume (value0 = horse race)
COSTUME_SASH = 3, // AVA2 sash (85001..85024)
COSTUME_MOUNT_SKIN = 4, // AVA2 mount skin (value0 = horse race, needs COSTUME_MOUNT)
COSTUME_WEAPON = 5, // PORT: preserve existing mount-skin subtype 4.
COSTUME_NEW_SASH = 6,
COSTUME_PET = 7,
COSTUME_NUM_TYPES,
};
+9 -2
View File
@@ -64,7 +64,7 @@ enum EMisc
DRAGON_SOUL_REFINE_GRID_SIZE = 15,
MAX_AMOUNT_OF_MALL_BONUS = 20,
WEAR_MAX_NUM = 32,
WEAR_MAX_NUM = 40, // PORT: shop costume/pet/shining equipment.
//LIMIT_GOLD
GOLD_MAX = 2000000000,
@@ -144,7 +144,14 @@ enum EWearPositions
WEAR_RINGS_1, // 28 : AVA2 new ring (ITEM_NEW_RINGS)
WEAR_RINGS_2, // 29 : AVA2 new ring
WEAR_MAX = 32 //
WEAR_COSTUME_WEAPON = 30,
WEAR_COSTUME_PET = 31,
WEAR_PET = 32,
WEAR_COSTUME_NEW_SASH = 33,
WEAR_SHINING_WEAPON = 34,
WEAR_SHINING_ARMOR = 35,
WEAR_SHINING_SPECIAL = 36,
WEAR_MAX = 40 // PORT: extended appearance equipment.
};
enum EDragonSoulDeckType
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <stdint.h>
#include <algorithm>
#include <string>
// User-authorized extension. Chance uses basis points; zero disables that source.
struct PortPointDropRule {
int chance, minimum, maximum, minimumLevel, maximumOverlevel, dailyCap;
bool valid() const {
return chance >= 0 && chance <= 10000 && minimum >= 1 && maximum >= minimum &&
maximum <= 1000000 && minimumLevel >= 0 && maximumOverlevel >= 0 && dailyCap >= 0;
}
bool eligible(int targetLevel, int playerLevel) const {
return valid() && chance > 0 && targetLevel >= minimumLevel && playerLevel > 0 &&
(!maximumOverlevel || playerLevel - targetLevel <= maximumOverlevel);
}
};
template<class Lookup> PortPointDropRule PortPointRule(Lookup flag, bool stone) {
const std::string prefix = stone ? "points_stone_" : "points_mob_";
const int minimum = flag(prefix + "min");
const int maximum = flag(prefix + "max");
return {flag(prefix + "chance"), minimum ? minimum : 1,
maximum ? maximum : (minimum ? minimum : 1), flag("points_min_level"),
flag("points_max_overlevel"), flag("points_daily_cap")};
}
inline uint32_t PortPointDropAmount(uint32_t requested, uint64_t earned, uint32_t cap) {
if (!cap) return requested;
if (earned >= cap) return 0;
return static_cast<uint32_t>(std::min<uint64_t>(requested, cap - earned));
}
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <stdint.h>
#include <string>
#include <cstring>
// PORT: supplementary AVA2 pet/rarity state. Classic item packets retain 3 sockets / 7 attributes.
#pragma pack(push,1)
struct PortItemExtra {
int32_t sockets[5];
uint8_t types[8];
int16_t values[8];
char name[25];
};
#pragma pack(pop)
static_assert(sizeof(PortItemExtra)==69,"extended item state");
inline std::string PortItemExtraHex(const PortItemExtra& extra) {
static const char digits[]="0123456789abcdef";
const auto p=reinterpret_cast<const unsigned char*>(&extra);
std::string result(sizeof(extra)*2,'0');
for(unsigned i=0;i<sizeof(extra);++i){result[2*i]=digits[p[i]>>4];result[2*i+1]=digits[p[i]&15];}
return result;
}
inline bool PortItemExtraRead(const char* hex,PortItemExtra& extra) {
std::memset(&extra,0,sizeof(extra));
if(!hex || !*hex)return true;
if(std::strlen(hex)!=sizeof(extra)*2)return false;
auto nibble=[](char c){return c>='0' && c<='9'?c-'0':c>='A' && c<='F'?c-'A'+10:c>='a' && c<='f'?c-'a'+10:-1;};
auto p=reinterpret_cast<unsigned char*>(&extra);
for(unsigned i=0;i<sizeof(extra);++i){int a=nibble(hex[2*i]),b=nibble(hex[2*i+1]);if(a<0 || b<0){std::memset(&extra,0,sizeof(extra));return false;}p[i]=(a<<4)|b;}
extra.name[24]=0;return true;
}
+2
View File
@@ -1,3 +1,4 @@
#include "port_item_extra.h"
#ifndef __INC_TABLES_H__
#define __INC_TABLES_H__
@@ -398,6 +399,7 @@ typedef struct SPlayerItem
TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
DWORD owner;
PortItemExtra extra; // PORT: internal game/db state, not a classic client packet.
} TPlayerItem;
typedef struct SQuickslot