Trading request system (#1460)

* mapping public stores update

* base selling platform update

* basic UI setup

* Update coin icon textures

Refreshed the c, g, p, and s coin images in the interface textures. This likely improves their appearance or corrects previous visual issues.

* parse requests data into UI

* selling platform UI state now include price

Updated the selling platform UI to display the calculated price of placed items. Moved the UpdateSellingUIState logic from the shared system to the server system, and modified the CP14SellingPlatformUiState to include a price field. The client window now uses the state-provided price instead of a hardcoded value.

* Update selling UI state on item placed or removed

Added event subscriptions for ItemPlacedEvent and ItemRemovedEvent to update the selling UI state when items are placed or removed from the selling platform. Refactored UpdateSellingUIState to remove the user parameter, as it is no longer needed.

* sell button works now

Replaces the previous sell request mechanism with a new CP14TradingSellAttempt message for selling items on the platform. Updates client and server logic to use this new message, adds a CanSell helper for item validation, and refactors related UI and event handling code for improved clarity and maintainability.

* auto pricing requirements

* Refactor reputation reward to use cashback rate

Reputation rewards for selling requests are now calculated as a percentage (cashback) of the sale price, rather than a fixed value. Updated the relevant UI, server logic, and prototype fields to reflect this change. Also cleaned up the brad_potions.yml prototype file by removing a duplicate entry and correcting an ID.

* request rerolling
This commit is contained in:
Red
2025-06-23 01:21:25 +03:00
committed by GitHub
parent fb76a9d80d
commit b1a9fca5ee
53 changed files with 31114 additions and 5958 deletions

View File

@@ -6,6 +6,14 @@
- type: CP14AbstractKey
group: Merchant
- type: entity
parent: CP14KeyCopperBlank
id: CP14KeyMercantShopPublic
suffix: Merchant public shop
components:
- type: CP14Key
autoGenerateShape: ShopPublic
- type: entity
parent: CP14KeyIronBlank
id: CP14KeyMercantShop1

View File

@@ -95,6 +95,7 @@
components:
- type: StorageFill
contents:
- id: CP14KeyMercantShopPublic
- id: CP14KeyTavernMerchantShopAbstract
- type: entity

View File

@@ -1,5 +1,23 @@
# Wooden
- type: entity
parent: CP14WoodenDoor
id: CP14WoodenDoorMerchantShopPublic
suffix: Merchant public shop
components:
- type: CP14Lock
autoGenerateShape: ShopPublic
- type: Lock
locked: false #Public shops opened by roundstart
- type: entity
parent:
- CP14WoodenDoorMerchantShopPublic
- CP14WoodenDoorMirrored
id: CP14WoodenDoorMerchantShopPublicMirrored
suffix: Merchant public shop, Mirrored
- type: entity
parent: CP14WoodenDoor
id: CP14WoodenDoorMerchantShop1
@@ -17,6 +35,7 @@
id: CP14WoodenDoorMerchantShopMirrored1
suffix: Merchant shop 1, Mirrored
- type: entity
parent: CP14WoodenDoor
id: CP14WoodenDoorMerchantShop2
@@ -34,6 +53,7 @@
id: CP14WoodenDoorMerchantShopMirrored2
suffix: Merchant shop 2, Mirrored
- type: entity
parent: CP14WoodenDoor
id: CP14WoodenDoorMerchantShop3

View File

@@ -16,13 +16,13 @@
sprite: _CP14/Structures/Specific/Economy/buy_platform.rsi
state: base
- type: ActivatableUI
key: enum.CP14TradingUiKey.Key
key: enum.CP14TradingUiKey.Buy
- type: Clickable
- type: InteractionOutline
- type: CP14TradingPlatform
- type: UserInterface
interfaces:
enum.CP14TradingUiKey.Key:
enum.CP14TradingUiKey.Buy:
type: CP14TradingPlatformBoundUserInterface
- type: PlaceableSurface
- type: ItemPlacer
@@ -71,6 +71,12 @@
- type: PlaceableSurface
- type: ItemPlacer
maxEntities: 0
- type: ActivatableUI
key: enum.CP14TradingUiKey.Sell
- type: UserInterface
interfaces:
enum.CP14TradingUiKey.Sell:
type: CP14SellingPlatformBoundUserInterface
- type: Fixtures
fixtures:
fix1:
@@ -84,14 +90,6 @@
- MidImpassable
- LowImpassable
hard: false
- type: CP14MagicEnergyContainer
maxEnergy: 30
energy: 0
unsafeSupport: true
- type: CP14MagicEnergyDraw
energy: -1
delay: 3 # 5m to full restore
- type: CP14MagicEnergyExaminable
- type: entity
id: CP14CashImpact

View File

@@ -78,6 +78,11 @@
complexity: 5
name: cp14-lock-shape-blacksmith3
- type: CP14LockType
id: ShopPublic
complexity: 3
name: cp14-lock-shape-merchant-public
- type: CP14LockType
id: Shop1
group: Merchant

View File

@@ -1,16 +1,6 @@
# Rep 0
- type: cp14TradingPosition
id: CP14OreCopper5
faction: DwarfMining
uiPosition: 0
icon:
sprite: _CP14/Objects/Materials/copper_ore.rsi
state: ore2
service: !type:CP14BuyItemsService
product: CP14OreCopper5
- type: cp14TradingPosition
id: CP14CopperBar5
faction: DwarfMining
@@ -32,16 +22,6 @@
service: !type:CP14BuyItemsService
product: CP14GlassSheet5
- type: cp14TradingPosition
id: CP14Torch
faction: DwarfMining
uiPosition: 7
icon:
sprite: _CP14/Objects/Tools/torch.rsi
state: torch-unlit
service: !type:CP14BuyItemsService
product: CP14Torch
- type: cp14TradingPosition
id: CP14ModularIronPickaxe
faction: DwarfMining
@@ -76,17 +56,6 @@
# Rep 1
- type: cp14TradingPosition
id: CP14OreIron5
faction: DwarfMining
reputationLevel: 1
uiPosition: 0
icon:
sprite: _CP14/Objects/Materials/iron_ore.rsi
state: ore2
service: !type:CP14BuyItemsService
product: CP14OreIron5
- type: cp14TradingPosition
id: CP14IronBar5
faction: DwarfMining
@@ -101,28 +70,6 @@
# Rep 2
- type: cp14TradingPosition
id: CP14OreGold5
faction: DwarfMining
reputationLevel: 2
uiPosition: 0
icon:
sprite: _CP14/Objects/Materials/gold_ore.rsi
state: ore2
service: !type:CP14BuyItemsService
product: CP14OreGold5
#- type: cp14TradingPosition
# id: CP14OreMithril5
# faction: DwarfMining
# reputationLevel: 2
# uiPosition: 1
# icon:
# sprite: _CP14/Objects/Materials/mithril_ore.rsi
# state: ore2
# service: !type:CP14BuyItemsService
# product: CP14OreMithril5
- type: cp14TradingPosition
id: CP14GoldBar5
faction: DwarfMining
@@ -135,18 +82,6 @@
service: !type:CP14BuyItemsService
product: CP14GoldBar5
#- type: cp14TradingPosition
# id: CP14MithrilBar5
# faction: DwarfMining
# reputationLevel: 2
# priceMarkup: 5
# uiPosition: 5
# icon:
# sprite: _CP14/Objects/Materials/mithril_bar.rsi
# state: bar_2
# service: !type:CP14BuyItemsService
# product: CP14MithrilBar5
- type: cp14TradingPosition
id: CP14BaseSharpeningStoneStructure
faction: DwarfMining

View File

@@ -0,0 +1,89 @@
- type: cp14TradingRequest
id: BradPotionsWildSage
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14WildSage
count: 5
- type: cp14TradingRequest
id: BradPotionsAirLily
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14AirLily
count: 5
- type: cp14TradingRequest
id: BradPotionsChromiumSlime
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14ChromiumSlime
count: 5
- type: cp14TradingRequest
id: BradPotionsAgaricMushroom
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14AgaricMushroom
count: 5
- type: cp14TradingRequest
id: BradPotionsDayflin
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14Dayflin
count: 5
- type: cp14TradingRequest
id: BradPotionsBloodFlower
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14BloodFlower
count: 5
- type: cp14TradingRequest
id: BradPotionsSilverNeedle
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14SilverNeedle
count: 5
- type: cp14TradingRequest
id: BradPotionsLumiMushroom
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14LumiMushroom
count: 5
- type: cp14TradingRequest
id: BradPotionsBlueAmanita
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14BlueAmanita
count: 5
- type: cp14TradingRequest
id: BradPotionsQuartz
possibleFactions:
- BradPotions
requirements:
- !type:ProtoIdResource
protoId: CP14CrystalShardQuartz
count: 5

View File

@@ -0,0 +1,68 @@
- type: cp14TradingRequest
id: DwarfMiningCopper
possibleFactions:
- DwarfMining
requirements:
- !type:StackResource
stack: CP14OreCopper
count: 10
- type: cp14TradingRequest
id: DwarfMiningIron
possibleFactions:
- DwarfMining
requirements:
- !type:StackResource
stack: CP14OreIron
count: 10
- type: cp14TradingRequest
id: DwarfMiningDirt
possibleFactions:
- DwarfMining
requirements:
- !type:StackResource
stack: CP14Dirt
count: 50
- type: cp14TradingRequest
id: DwarfMiningStone
possibleFactions:
- DwarfMining
requirements:
- !type:StackResource
stack: CP14Stone
count: 50
- type: cp14TradingRequest
id: DwarfMiningTorch
possibleFactions:
- DwarfMining
requirements:
- !type:ProtoIdResource
protoId: CP14Torch
count: 10
# 30 minutes
- type: cp14TradingRequest
id: DwarfMiningGold
possibleFactions:
- DwarfMining
fromMinutes: 30
requirements:
- !type:StackResource
stack: CP14OreGold
count: 10
# 60 minutes
- type: cp14TradingRequest
id: DwarfMiningMithril
possibleFactions:
- DwarfMining
fromMinutes: 60
requirements:
- !type:StackResource
stack: CP14OreMithril
count: 10

View File

@@ -0,0 +1,8 @@
- type: cp14TradingRequest
id: ThaumaturgyDimensit
possibleFactions:
- Thaumaturgy
requirements:
- !type:ProtoIdResource
protoId: CP14DimensitCrystal
count: 5