1888 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
110 lines
7.9 KiB
Diff
110 lines
7.9 KiB
Diff
--- a/native/inventory_translation.cpp
|
|
+++ b/native/inventory_translation.cpp
|
|
@@ -72,6 +72,16 @@
|
|
return {0xab,turtle_item_use(request,from.bag,from.slot,known)};
|
|
}
|
|
LegacyPacket NativeInventoryTranslation::gameplay(uint32_t opcode,std::span<const uint8_t> body) const{
|
|
+ if(opcode==0x3f0105){
|
|
+ // Actual70334 CMSG_SET_AMMO carries an entry, not an inventory GUID
|
|
+ // or a physical equipment move. The stack remains in its source bag.
|
|
+ Reader r(body);auto entry=uint32_t(r.le(4));r.end();
|
|
+ if(entry && std::none_of(items.begin(),items.end(),[&](const auto& row){
|
|
+ auto it=row.second.fields.find(F::OBJECT_FIELD_ENTRY);
|
|
+ return it!=row.second.fields.end() && it->second==entry;
|
|
+ }))throw Error("ammunition selection outside authenticated owned inventory");
|
|
+ Bytes out;le(out,entry,4);return {0x268,std::move(out)};
|
|
+ }
|
|
if(opcode!=0x410007 && opcode!=0x410004 && opcode!=0x410008 && opcode!=0x410006)throw Error("unsupported inventory request");
|
|
Reader r(body);auto header=r.le(1),count=header>>6;
|
|
if(header&63)throw Error("inventory request metadata padding");
|
|
@@ -151,7 +161,7 @@
|
|
bool bb=(index>=F::PLAYER_FIELD_VENDORBUYBACK_SLOT_1 && index<F::PLAYER_FIELD_VENDORBUYBACK_SLOT_1+24) ||
|
|
(index>=F::PLAYER_FIELD_BUYBACK_PRICE_1 && index<F::PLAYER_FIELD_BUYBACK_PRICE_1+12) ||
|
|
(index>=F::PLAYER_FIELD_BUYBACK_TIMESTAMP_1 && index<F::PLAYER_FIELD_BUYBACK_TIMESTAMP_1+12);
|
|
- if(bb || index==F::PLAYER_BYTES_2 || (index>=F::PLAYER_VISIBLE_ITEM_1_CREATOR && index<=F::PLAYER_FIELD_BANKBAG_SLOT_END)){player_fields[index]=value;touched=true;buyback|=bb;}
|
|
+ if(bb || index==F::PLAYER_BYTES_2 || index==F::PLAYER_AMMO_ID || (index>=F::PLAYER_VISIBLE_ITEM_1_CREATOR && index<=F::PLAYER_FIELD_BANKBAG_SLOT_END)){player_fields[index]=value;touched=true;buyback|=bb;}
|
|
}
|
|
if(touched && (!initial || buyback)){LegacyObjectUpdate update;update.guid=self;update.type=4;update.fields=player_fields;changed.push_back(std::move(update));}
|
|
continue;
|
|
--- a/native/world_translation.cpp
|
|
+++ b/native/world_translation.cpp
|
|
@@ -413,7 +413,7 @@
|
|
if(amount>255)throw Error("sell quantity outside Turtle byte-count protocol");
|
|
Bytes out;le(out,vendor,8);le(out,item,8);le(out,amount,1);return {0x1a0,std::move(out)};
|
|
}
|
|
- if(opcode==0x410007 || opcode==0x410004 || opcode==0x410008 || opcode==0x410006)return inventory.gameplay(opcode,body);
|
|
+ if(opcode==0x410007 || opcode==0x410004 || opcode==0x410008 || opcode==0x410006 || opcode==0x3f0105)return inventory.gameplay(opcode,body);
|
|
Reader r(body);auto known=bindings();
|
|
if(opcode==0x3e011f){r.end();return {0x142,{}};}
|
|
if(opcode==0x3f002b){
|
|
--- a/src/forever_create.cpp
|
|
+++ b/src/forever_create.cpp
|
|
@@ -463,6 +463,12 @@
|
|
if(id!=self || kind!=0)throw Error("inventory player identity");
|
|
UF::ActivePlayerData active;UF::ActivePlayerData::Mask am;UF::PlayerData player;UF::PlayerData::Mask pm;UF::UnitData unit;UF::UnitData::Mask um;
|
|
bool have_active=false,have_player=false,have_unit=false;
|
|
+ if(f.contains(Turtle::PLAYER_AMMO_ID)){
|
|
+ // Classic70334 repurposes PvpMedals as AmmoID. Apply
|
|
+ // only actual source updates, including explicit zero.
|
|
+ const_cast<uint32&>(*active.PvpMedals)=value(Turtle::PLAYER_AMMO_ID);
|
|
+ am.Set(102);am.Set(107);have_active=true;
|
|
+ }
|
|
auto slot=[&](unsigned legacy,unsigned modern){
|
|
if(!f.contains(legacy) && !f.contains(legacy+1))return;
|
|
const_cast<ObjectGuid&>(active.InvSlots[modern])=item_guid(pair(legacy));am.Set(163);am.Set(164+modern);have_active=true;
|
|
@@ -1179,6 +1185,7 @@
|
|
append_item(bank,242709,1,0,0,nullptr,&bank_data);
|
|
const_cast<ObjectGuid&>(active.InvSlots[63])=bank;set(active.NumCharacterBankTabs,uint8_t(1));
|
|
auto purchased_bank_bags=(value(Turtle::PLAYER_BYTES_2)>>16)&255;
|
|
+ set(active.PvpMedals,value(Turtle::PLAYER_AMMO_ID));
|
|
if(purchased_bank_bags>6)throw Error("unsupported source purchased bank bag count");
|
|
set(active.NumBankSlots,uint8_t(purchased_bank_bags));
|
|
// Original Camelot BankFrame enumerates purchased tab settings, not
|
|
--- a/ops/build_forever_create.py
|
|
+++ b/ops/build_forever_create.py
|
|
@@ -129,7 +129,7 @@
|
|
active_start=text.index('static uint32 ClassicActivePlayerDataBit(')
|
|
active_end=text.index('void ActivePlayerData::WriteUpdate(Mask const&',active_start)
|
|
active_helpers=text[active_start:active_end]
|
|
- allowed_active={32,58,60,61,63,64,70,72,73,75,77,78,79,101,102,124,132,133,134,147,148,163,311}
|
|
+ allowed_active={32,58,60,61,63,64,70,72,73,75,77,78,79,101,102,107,124,132,133,134,147,148,163,311}
|
|
for kind in ('ActivePlayerData','TraitConfig','SkillInfo'):
|
|
needle='void '+kind+'::WriteUpdate('+('Mask const&' if kind=='ActivePlayerData' else 'bool ignoreChangesMask')
|
|
start=text.index(needle);brace=text.index('{',start);depth=1;end=brace+1
|
|
--- a/include/gateway/turtle_entity_profile.hpp
|
|
+++ b/include/gateway/turtle_entity_profile.hpp
|
|
@@ -30,6 +30,7 @@
|
|
inline constexpr unsigned PLAYER_FIELD_INV_SLOT_HEAD=486;
|
|
inline constexpr unsigned PLAYER_FIELD_PACK_SLOT_1=532;
|
|
inline constexpr unsigned PLAYER_BYTES_2=194;
|
|
+inline constexpr unsigned PLAYER_AMMO_ID=1223;
|
|
inline constexpr unsigned PLAYER_FIELD_BANK_SLOT_1=564;
|
|
inline constexpr unsigned PLAYER_FIELD_BANKBAG_SLOT_1=612;
|
|
inline constexpr unsigned PLAYER_FIELD_BANKBAG_SLOT_END=623;
|
|
--- a/tests/native_inventory_test.cpp
|
|
+++ b/tests/native_inventory_test.cpp
|
|
@@ -66,6 +66,23 @@
|
|
auto swap=state.gameplay(0x410007,Bytes{0x80,255,35,255,15,15,35});
|
|
check(swap.opcode==0x10d && swap.body==Bytes({23,15}));
|
|
auto equip=state.gameplay(0x410004,Bytes{0x40,255,35,255,35});check(equip.opcode==0x10a && equip.body==Bytes({255,23}));
|
|
+ // Ammo selection names an owned entry and never moves/deletes its stack.
|
|
+ Bytes ammo;le(ammo,25,4);auto selectedAmmo=state.gameplay(0x3f0105,ammo);
|
|
+ check(selectedAmmo.opcode==0x268 && selectedAmmo.body==ammo && state.items.at(item).fields.at(14)==1);
|
|
+ check(state.gameplay(0x3f0105,Bytes(4)).body==Bytes(4));
|
|
+ for(auto invalid:{Bytes{},Bytes{25},Bytes{25,0,0},Bytes{25,0,0,0,0},Bytes{26,0,0,0}}){
|
|
+ bool rejected=false;try{state.gameplay(0x3f0105,invalid);}catch(const Error&){rejected=true;}check(rejected);
|
|
+ }
|
|
+ // Source-confirmed selection and clearing must carry a real native scalar,
|
|
+ // not just set an update-mask bit with its writer filtered out.
|
|
+ NativeInventoryTranslation ammoState;
|
|
+ auto ammoUpdate=ammoState.translate(update(self,0,0,{{turtle_entity_fields::PLAYER_AMMO_ID,13377}}),self,70,0,false,codec);
|
|
+ check(count(ammoUpdate)==1 && ammoState.player_fields.at(turtle_entity_fields::PLAYER_AMMO_ID)==13377);
|
|
+ Bytes ammoTail;le(ammoTail,13377,4);
|
|
+ check(ammoUpdate[0].body.size()>=4 && std::equal(ammoTail.begin(),ammoTail.end(),ammoUpdate[0].body.end()-4));
|
|
+ auto clearAmmo=ammoState.translate(update(self,0,0,{{turtle_entity_fields::PLAYER_AMMO_ID,0}}),self,70,0,false,codec);
|
|
+ check(count(clearAmmo)==1 && ammoState.player_fields.at(turtle_entity_fields::PLAYER_AMMO_ID)==0);
|
|
+ check(clearAmmo[0].body.size()>=4 && std::all_of(clearAmmo[0].body.end()-4,clearAmmo[0].body.end(),[](uint8_t b){return b==0;}));
|
|
Bytes bagError{29};le(bagError,item,8);le(bagError,0,8);le(bagError,0,1);
|
|
auto failed=run({0x112,bagError});check(failed.size()==1 && failed[0].opcode==0x6a0005);
|
|
Reader bagFailure(failed[0].body);check(bagFailure.le(4)==30 && unpack_guid(bagFailure,16)==Bytes(timerItem.begin(),timerItem.end()));check(unpack_guid(bagFailure,16)==Bytes(16) && bagFailure.le(1)==0);bagFailure.end();
|