feat(scripting): connect give_item to wallet rewards, add [E] Interact prompt and toast feedback
checkpoint / checkpoint (push) Failing after 6m2s
checkpoint / checkpoint (push) Failing after 6m2s
This commit is contained in:
@@ -76,3 +76,38 @@ async def get_wallet_transactions(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
|
||||
class RewardRequest(BaseModel):
|
||||
amount: int = Field(..., gt=0, le=10000, description="Amount of Buffalo Chips to reward")
|
||||
reason: str | None = Field(default="in_game_reward", description="Reward source or reason")
|
||||
|
||||
|
||||
class RewardResponse(BaseModel):
|
||||
success: bool
|
||||
amount: int
|
||||
new_balance: int
|
||||
|
||||
|
||||
@router.post("/reward", response_model=RewardResponse)
|
||||
async def reward_chips(
|
||||
payload: RewardRequest,
|
||||
current_user: CurrentUser,
|
||||
db: DbDep,
|
||||
):
|
||||
"""Credit in-game Buffalo Chips reward directly to the player's wallet."""
|
||||
wallet, tx = await wallet_service.credit(
|
||||
db,
|
||||
user_id=current_user.id,
|
||||
amount=payload.amount,
|
||||
tx_type=TransactionType.admin_adjustment,
|
||||
reference_type="gameplay_reward",
|
||||
reference_id=payload.reason or "in_game_reward",
|
||||
metadata={"reason": payload.reason or "in_game_reward"},
|
||||
)
|
||||
return RewardResponse(
|
||||
success=True,
|
||||
amount=payload.amount,
|
||||
new_balance=wallet.balance,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user