Skip to content

Commit

Permalink
raydienull's LAYER_STABLE PR merge
Browse files Browse the repository at this point in the history
- Merged: raydienull's LAYER_STABLE build merged, but LAYER_AUCTION keep same as LAYER_STABLE added as a new layer. (PR: #1201)
- Fixed: raydienull's LAYER_STABLE follower triggers doesn't called while taking pet out of stable.
- Fixed: raydienull's LAYER_STABLE doesn't work with the new follower system.
- Removed: Unnecessary LINK == PLAYER checks as figurines will be stocked on the owned player.
  • Loading branch information
xwerswoodx committed Apr 17, 2024
1 parent 3d86b36 commit 4ad60ab
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 77 deletions.
107 changes: 57 additions & 50 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3442,6 +3442,9 @@ Additionally, the problem of zig-zag issue following in the South direction has
13-12-2023, Nolok
- Fixed: Rare crash occurring when a NPC is selecting an attackable target, but there's only one target (not attackable) in sight.

15-12-2023, raydienull
- Changed: LAYER_AUCTION to LAYER_STABLE and now is used to store the stabled pets on the player.

12-02-2024, Drk84
- Updated SphereCrypt.ini.

Expand All @@ -3454,31 +3457,31 @@ Additionally, the problem of zig-zag issue following in the South direction has
- Added: Item been eaten can now be read on the ARGO parameter of the trigger @Eat.

24-03-2024, xwerswoodx
Fixed: The issue that causes more1/2 not saved correctly for spellbook. (Issue: #1221)
Fixed: Players automatically become criminal to everyone when attack someone. (Issue: #1213)
Fixed: CallGuard not working correctly on the players that only criminal for target. (Issue: #1213, #1040)
Fixed: The wrong input of Kill trigger, to make it compatible with older sphere versions. (Issue: #1210)
Added: New Layer LAYER_STORAGE (80) to let scripters create their own storage system. (Issue: #1209)
- Fixed: The issue that causes more1/2 not saved correctly for spellbook. (Issue: #1221)
- Fixed: Players automatically become criminal to everyone when attack someone. (Issue: #1213)
- Fixed: CallGuard not working correctly on the players that only criminal for target. (Issue: #1213, #1040)
- Fixed: The wrong input of Kill trigger, to make it compatible with older sphere versions. (Issue: #1210)
- Added: New Layer LAYER_STORAGE (80) to let scripters create their own storage system. (Issue: #1209)
Only t_container and t_container_locked can be equipped to this layer.
Changed: Decay time removed from spawned items, as Sphere gives tons of invalid link errors when items decayed. (Issue: #1218)
Added: New spellflag SPELLFLAG_ASYNC (0100000000) to randomize field timers like old sphere versions. (Issue: #1169)
- Changed: Decay time removed from spawned items, as Sphere gives tons of invalid link errors when items decayed. (Issue: #1218)
- Added: New spellflag SPELLFLAG_ASYNC (0100000000) to randomize field timers like old sphere versions. (Issue: #1169)
SPELLFLAG_ASYNC should be added to defs.
Added: New spellflag SPELLFLAG_TARG_ONLYSELF (0200000000) to make spell only be used on character himself. (Issue: #1171)
- Added: New spellflag SPELLFLAG_TARG_ONLYSELF (0200000000) to make spell only be used on character himself. (Issue: #1171)
SPELLFLAG_TARG_ONLYSELF should be added to defs.
//magery_9 "You can only use this spell on yourself." could be added to defmessages.
Changed: SERV.LOG command changed to support console colors. (Issue: [Feature Request] Colored Serv & Src Log System #1158)
- Changed: SERV.LOG command changed to support console colors. (Issue: [Feature Request] Colored Serv & Src Log System #1158)
SERV.LOG works same as before.
Usage of custom color system is: SERV.LOG @color,type,mask message
Example: SERV.LOG @CTCOL_RED,LOGL_EVENT,LOGM_NOCONTEXT|LOGM_KILLS message
LOGM, LOGL and CTCOL values should be added to defs.

25-03-2024, xwerswoodx
Added: Sphere.ini setting CanPetsDrinkPotion (true in default) to make pets drink potion when their owner drop it on it. (Issue: #1147)
- Added: Sphere.ini setting CanPetsDrinkPotion (true in default) to make pets drink potion when their owner drop it on it. (Issue: #1147)
CanPetsDrinkPotion = 0 can be added to sphere.ini to disable that.
Fixed: Missing fCheckOnly checks block the taming skill. (Issue: #1219)
- Fixed: Missing fCheckOnly checks block the taming skill. (Issue: #1219)

26-03-2024, xwerswoodx
Added: New trigger @Drink added for characters. (Issue: #1162)
- Added: New trigger @Drink added for characters. (Issue: #1162)
I: The character drinking the item.
SRC: The character drinking the item.
ARGO = the item that drank
Expand All @@ -3491,80 +3494,80 @@ Added: New trigger @Drink added for characters. (Issue: #1162)
6: Let character to drink but will not give any empty bottle.
- Messages:
DRINK_NOT_ENOUGH, "You don't have enough %s to drink this."
Added: New trigger @AfkMode added for characters. (Issue: #1161)
- Added: New trigger @AfkMode added for characters. (Issue: #1161)
I: The character changing AFK status.
SRC: The character changing AFK status.
ARGN1 = Current Afk Status
ARGN2 = Next Afk Status
- Returns:
1: Stops character from switching afk status.
Added: New trigger @Reveal added for characters. (Issue: #1157)
- Added: New trigger @Reveal added for characters. (Issue: #1157)
I: The character who is revealing.
SRC: The character who is revealing.
- Returns:
1: Prevents character from being revealed.
Added: New triggers @ArrowQuest_Add and @ArrowQuest_Close added for characters. (Issue: #1116)
- Added: New triggers @ArrowQuest_Add and @ArrowQuest_Close added for characters. (Issue: #1116)
I: The character who activating/deactivating arrow quest.
SRC: The character who activating/deactivating arrow quest.
Added: New function triggers f_onaccount_block and f_onaccount_unblock. (Issue: #1156)
- Added: New function triggers f_onaccount_block and f_onaccount_unblock. (Issue: #1156)
ARGS = Account name.
- Returns:
1: Prevents account from blocking/unblocking.
Added: New function trigger f_onserver_broadcast. (Issue: #1145)
- Added: New function trigger f_onserver_broadcast. (Issue: #1145)
ARGS = message
- Returns:
1: Prevents server to send broadcast message.
Added: Two new LOCAL variables ItemPoisonReductionChance and ItemPoisonReductionAmount to @Hit trigger. (Issue: #1159)
- Added: Two new LOCAL variables ItemPoisonReductionChance and ItemPoisonReductionAmount to @Hit trigger. (Issue: #1159)
This LOCALs changes default behaviour of poisoned weapons while removing poison.
LOCAL.ItemPoisonReductionChance = Is the chance that weapon reduce poison morez. (Default 100%)
LOCAL.ItemPoisonReductionAmount = Is the amount of poison that weapon reduce. (Default: CurrentPoisonAmount/ 2)
Added: You can now use TDATA2 for setting default cooldown (delay) for drinks. (Default: 15secs for potions, 1500 secs for ales)
Changed: Reactive armor range increased from 1 to 2 in default.
- Added: You can now use TDATA2 for setting default cooldown (delay) for drinks. (Default: 15secs for potions, 1500 secs for ales)
- Changed: Reactive armor range increased from 1 to 2 in default.

27-03-2024, xwerswoodx
Fixed: Possible fix for accesses and bans not loading for multis. (Issue: #1223)
Fixed: Possible fix for wrong damage calculation of slayer bonus damage. (Issue: #1179)
- Fixed: Possible fix for accesses and bans not loading for multis. (Issue: #1223)
- Fixed: Possible fix for wrong damage calculation of slayer bonus damage. (Issue: #1179)

28-03-2024, xwerswoodx
Added: REGION_FLAG_HOUSE (0x0100) for houses. (Issue: #1154)
- Added: REGION_FLAG_HOUSE (0x0100) for houses. (Issue: #1154)
REGION_FLAG_HOUSE 0100 should be added defs.

30-03-2024, xwerswoodx
Added: ARGO object for @MurderMark trigger to get killed character.
Fixed: ARGN1 (reap amount) doesn't updated depends on the amount left on bit. (Issue: #1224)
Added: ARGO to get bit uid under @ResourceGather and @RegionResourceGather triggers.
- Added: ARGO object for @MurderMark trigger to get killed character.
- Fixed: ARGN1 (reap amount) doesn't updated depends on the amount left on bit. (Issue: #1224)
- Added: ARGO to get bit uid under @ResourceGather and @RegionResourceGather triggers.

31-03-2024, xwerswoodx
Fixed: Possible fix for the OnRegionTrigger getting called on invalid region while multi creating/removing.
- Fixed: Possible fix for the OnRegionTrigger getting called on invalid region while multi creating/removing.

02-04-2024, xwerswoodx
Changed: dword CAN flags changed with uint64 to increase limits.
Fixed: Possible fix for chat debugs. (Issue: #1212) (Issue: https://discord.com/channels/354358315373035542/483721253773901824/1224030729906815077)
- Changed: dword CAN flags changed with uint64 to increase limits.
- Fixed: Possible fix for chat debugs. (Issue: #1212) (Issue: https://discord.com/channels/354358315373035542/483721253773901824/1224030729906815077)

03-04-2024, xwerswoodx
Added: "MOREX" key to set amount of fruit given when the crop ripped.
Changed: Now @Create trigger called when crop grow to let people to change MORE values in stages if needed.
Added: @ResourceTest trigger added for crops. (This trigger works separately for every stage)
- Added: "MOREX" key to set amount of fruit given when the crop ripped.
- Changed: Now @Create trigger called when crop grow to let people to change MORE values in stages if needed.
- Added: @ResourceTest trigger added for crops. (This trigger works separately for every stage)
I: Crop UID
SRC: Player who uses plant.
ARGN1: Next state item ID [Writeable]
ARGN2: Fruit ID (if exists) [Writeable]
ARGN3: Fruit ID Override (if exists) [Writeable]
- Returns:
1: Stop the fruit checks.
Added: @ResourceGather trigger added for crops. (This trigger works separately for every stage)
- Added: @ResourceGather trigger added for crops. (This trigger works separately for every stage)
I: Crop UID
SRC: Player who is gathering plant.
ARGN1: Amount of fruit. [Writeable]
ARGO: Fruit UID
- Returns:
1: Prevent player to gather fruit.
6: Let player to gather fruit but it will drop to the ground instead of backpack.
Fixed: Possible fix for invalid ResourceID warnings. (Issue: #1071)
- Fixed: Possible fix for invalid ResourceID warnings. (Issue: #1071)

08-04-2024, xwerswoodx
Fixed: Missing REGION reference for multis. (Issue: #1228)
Added: ElementalEngineFlags variable added to sphere.ini to let servers to filter elemental engine. (Issue: #1230)
- Fixed: Missing REGION reference for multis. (Issue: #1228)
- Added: ElementalEngineFlags variable added to sphere.ini to let servers to filter elemental engine. (Issue: #1230)
EE_CURSE = 0x1, // Adds Elemental buff/defuff to curse spell.
EE_MASS_CURSE = 0x2, // Adds Elemental buff/defuff to mass curse spell.
EE_REACTIVE_ARMOR = 0x4, // Adds Elemental buff/defuff to reactive armor spell.
Expand All @@ -3576,23 +3579,23 @@ Added: ElementalEngineFlags variable added to sphere.ini to let servers to filte
EE_RESPHYSICAL = 0x100 // Use RESPHYSICAL value instead of ARMOR for defense calculation.

09-04-2024, xwerswoodx
Fixed: An issue that causes T_MULTI_CUSTOM keep multi count saved. (Issue: #1232)
Fixed: Bonded pets cannot see their master while DeadCannotSeeLiving equals to 2. (Issue: #1225)
Fixed: The issue that causes Guilds without an align shown enemy to the players with a guild with an align. (Issue: #1208)
Fixed: Another fix for Invalid ResourceID console warnings. (Issue: #1071)
Fixed: GMs cannot dress up players. (Issue: #901)
- Fixed: An issue that causes T_MULTI_CUSTOM keep multi count saved. (Issue: #1232)
- Fixed: Bonded pets cannot see their master while DeadCannotSeeLiving equals to 2. (Issue: #1225)
- Fixed: The issue that causes Guilds without an align shown enemy to the players with a guild with an align. (Issue: #1208)
- Fixed: Another fix for Invalid ResourceID console warnings. (Issue: #1071)
- Fixed: GMs cannot dress up players. (Issue: #901)

10-04-2024, xwerswoodx
Fixed: Wrong check block GMs to unequip item from players.
- Fixed: Wrong check block GMs to unequip item from players.

14-04-2024, xwerswoodx
Fixed: An issue that causes a visual bug to remove all tiles while removing a tile in higher floors. (Issue: #345)
- Fixed: An issue that causes a visual bug to remove all tiles while removing a tile in higher floors. (Issue: #345)

16-04-2024, xwerswoodx
Changed: EMOTEF_EAT name changed to EMOTEF_HIDE_EAT_PLAYER and limited to only player emotes.
- Changed: EMOTEF_EAT name changed to EMOTEF_HIDE_EAT_PLAYER and limited to only player emotes.
EMOTEF_EAT is from the merge of Jhobean's pr so it wasn't in sphere at all.
Added: EMOTEF_HIDE_EAT_NPC to hide emotes while eating only for npcs.
Added: Trigger @Hit is added as an item trigger.
- Added: EMOTEF_HIDE_EAT_NPC to hide emotes while eating only for npcs.
- Added: Trigger @Hit is added as an item trigger.
This trigger nows trigger before @Damage but after character @Hit trigger.
Args are same as the character @Hit trigger, but I and ARGO switch the values.
Args:
Expand All @@ -3608,7 +3611,7 @@ Added: Trigger @Hit is added as an item trigger.
- LOCAL.ITEMPOISONREDUCTIONAMOUNT: Sets the amount of poison that reduced from morez value.
Returns:
1: Cancels the combat swing of the character.
Added: Trigger @GetHit is added as an item trigger.
- Added: Trigger @GetHit is added as an item trigger.
This trigger nows trigger before @Damage but after character @GetHit trigger.
Args are same as the character @GetHit trigger, but I changed to the item, and the character saves on ARGO.
Also LOCAL.ITEMDAMAGELAYER only works under character @GetHit trigger, it is only readable under item trigger.
Expand All @@ -3629,12 +3632,16 @@ Added: Trigger @GetHit is added as an item trigger.
- LOCAL.ITEMDAMAGELAYER: The layer of the item being damaged. [Read Only]
Returns:
1: Prevents damage from being applied to the character.
Added: MAPVIEWRADAR, MAPVIEWSIZE and MAPVIEWSIZEMAX to sphere.ini that overrides default visual range values. (Issue: #1144)
- Added: MAPVIEWRADAR, MAPVIEWSIZE and MAPVIEWSIZEMAX to sphere.ini that overrides default visual range values. (Issue: #1144)
Defaults:
MapViewRadar=31
MapViewSize=18
MapViewSizeMax=24
Added: 'H' shortcut for variables to get the value as hexadecimal.
- Added: 'H' shortcut for variables to get the value as hexadecimal.
For example, if you use .tag.test 100
<dTAG.TEST> returns 100
<hTAG.TEST> returns 064
<hTAG.TEST> returns 064
- Merged: raydienull's LAYER_STABLE build merged, but LAYER_AUCTION keep same as LAYER_STABLE added as a new layer.
- Fixed: raydienull's LAYER_STABLE follower triggers doesn't called while taking pet out of stable.
- Fixed: raydienull's LAYER_STABLE doesn't work with the new follower system.
- Removed: Unnecessary LINK == PLAYER checks as figurines will be stocked on the owned player.
40 changes: 17 additions & 23 deletions src/game/chars/CCharNPCAct_Vendor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ bool CChar::NPC_StablePetSelect( CChar * pCharPlayer )
if ( ! pCharPlayer->IsClientActive())
return false;

// Might have too many pets already ?
int iCount = 0;
CItemContainer * pBank = GetBank();
if ( pBank->GetContentCount() >= g_Cfg.m_iContainerMaxItems )
CItemContainer *pStableContainer = pCharPlayer->GetBank(LAYER_STABLE);
ASSERT(pStableContainer); //Should never terminate

if (pStableContainer->GetContentCount() >= g_Cfg.m_iContainerMaxItems)
{
Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_STABLEMASTER_FULL ) );
Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_STABLEMASTER_TOOMANY));
return false;
}

Expand Down Expand Up @@ -161,18 +161,6 @@ bool CChar::NPC_StablePetSelect( CChar * pCharPlayer )
}
}

for (CSObjContRec* pObjRec : *pBank)
{
CItem* pItem = static_cast<CItem*>(pObjRec);
if ( pItem->IsType(IT_FIGURINE) && pItem->m_uidLink == pCharPlayer->GetUID() )
++iCount;
}
if ( iCount >= iPetMax )
{
Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_STABLEMASTER_TOOMANY ) );
return false;
}

pCharPlayer->m_pClient->m_Targ_Prv_UID = GetUID();
pCharPlayer->m_pClient->addTarget( CLIMODE_TARG_PET_STABLE, g_Cfg.GetDefaultMsg( DEFMSG_NPC_STABLEMASTER_TARG ) );
return true;
Expand All @@ -188,24 +176,30 @@ bool CChar::NPC_StablePetRetrieve( CChar * pCharPlayer )
if ( m_pNPC->m_Brain != NPCBRAIN_STABLE )
return false;

CItemContainer* pBank = GetBank();
ASSERT(pBank);
CItemContainer* pStableContainer = pCharPlayer->GetBank(LAYER_STABLE);
ASSERT(pStableContainer);

int iCount = 0;
for (CSObjContRec* pObjRec : pBank->GetIterationSafeCont())
for (CSObjContRec* pObjRec : pStableContainer->GetIterationSafeCont())
{
CItem* pItem = static_cast<CItem*>(pObjRec);
if ( pItem->IsType(IT_FIGURINE) && (pItem->m_uidLink == pCharPlayer->GetUID()) )
if (pItem->IsType(IT_FIGURINE))
{
if ( !pCharPlayer->Use_Figurine(pItem) )
CChar* pPet = pCharPlayer->Use_Figurine(pItem);
if (!pPet)
{
tchar *pszTemp = Str_GetTemp();
snprintf(pszTemp, Str_TempLength(), g_Cfg.GetDefaultMsg(DEFMSG_NPC_STABLEMASTER_CLAIM_FOLLOWER), pItem->GetName());
Speak(pszTemp);
return true;
}

pItem->Delete();
pItem->Delete();
if (IsSetOF(OF_PetSlots))
{
const short iFollowerSlots = (short)pPet->GetDefNum("FOLLOWERSLOTS", true, 1);
pCharPlayer->FollowersUpdate(pPet, (maximum(0, iFollowerSlots)), false);
}
++iCount;
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/game/chars/CCharStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ CItemContainer *CChar::GetBank( LAYER_TYPE layer )
id = ITEMID_BACKPACK;
break;

case LAYER_STABLE:
id = ITEMID_POUCH;
break;

case LAYER_VENDOR_STOCK:
case LAYER_VENDOR_EXTRA:
case LAYER_VENDOR_BUYS:
Expand Down Expand Up @@ -344,6 +348,7 @@ LAYER_TYPE CChar::CanEquipLayer( CItem *pItem, LAYER_TYPE layer, CChar *pCharMsg
{
case LAYER_PACK:
case LAYER_AUCTION:
case LAYER_STABLE:
if ( !pItem->IsType(IT_CONTAINER) )
fCantEquip = true;
break;
Expand Down Expand Up @@ -442,6 +447,7 @@ LAYER_TYPE CChar::CanEquipLayer( CItem *pItem, LAYER_TYPE layer, CChar *pCharMsg
{
case LAYER_AUCTION:
case LAYER_PACK:
case LAYER_STABLE:
return LAYER_NONE; // this should not happen
case LAYER_HORSE:
case LAYER_DRAGGING:
Expand Down
6 changes: 3 additions & 3 deletions src/game/clients/CClientTarg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1610,12 +1610,12 @@ bool CClient::OnTarg_Pet_Stable( CChar * pCharPet )

if ( IsSetOF(OF_PetSlots) )
{
short iFollowerSlots = (short)pCharPet->GetDefNum("FOLLOWERSLOTS", true);
short iFollowerSlots = (short)pCharPet->GetDefNum("FOLLOWERSLOTS", true, 1);
m_pChar->FollowersUpdate(pCharPet,(-maximum(0, iFollowerSlots)));
}

pCharMaster->GetBank()->ContentAdd( pPetItem );
pCharMaster->Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_STABLEMASTER_CLAIM ) );
m_pChar->GetBank(LAYER_STABLE)->ContentAdd(pPetItem);
pCharMaster->Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_STABLEMASTER_CLAIM));
return true;
}

Expand Down
1 change: 1 addition & 0 deletions src/game/uo_files/uofiles_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ enum LAYER_TYPE // defined by UO. Only one item can be in a slot.
LAYER_SPELL_Mana_Drain,

LAYER_STORAGE, //80 New Storage layer, can equip t_container and t_container_locked.
LAYER_STABLE, //81 New stable layer, now stabled pets will be stored in this layer of the player instead of npc's itself.
LAYER_QTY
};

Expand Down
1 change: 0 additions & 1 deletion src/tables/defmessages.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ MSG(NPC_PET_TARG_TRANSFER_SUMMONED, "You cannot transfer ownership of a summone
MSG(NPC_PET_WAGE_COST, "I will work for %d gold")
MSG(NPC_PET_WEAK, "I'm too weak to carry that. ")
MSG(NPC_STABLEMASTER_FEED, "feed the %s")
MSG(NPC_STABLEMASTER_FULL, "I'm sorry the stables are full")
MSG(NPC_STABLEMASTER_TOOMANY, "You have too many pets in the stables!")
MSG(NPC_STABLEMASTER_TARG, "Which animal wouldst thou like to stable here?")
MSG(NPC_STABLEMASTER_TARG_SUCCESS, "Your pet has been stabled.")
Expand Down

0 comments on commit 4ad60ab

Please sign in to comment.