Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions migrations/2026/01/Version20260117222218.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Poppy Seed Pets API.
*
* The Poppy Seed Pets API is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* The Poppy Seed Pets API is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with The Poppy Seed Pets API. If not, see <https://www.gnu.org/licenses/>.
*/

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260117222218 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
$this->addSql(<<<EOSQL
-- tool effect
INSERT INTO item_tool (`id`, `stealth`, `nature`, `brawl`, `arcana`, `crafts`, `grip_x`, `grip_y`, `grip_angle`, `grip_scale`, `fishing`, `gathering`, `music`, `smithing`, `science`, `grip_angle_fixed`, `focus_skill`, `provides_light`, `protection_from_heat`, `always_in_front`, `is_ranged`, `when_gather_id`, `when_gather_also_gather_id`, `climbing`, `leads_to_adventure`, `prevents_bugs`, `attracts_bugs`, `can_be_nibbled`, `increases_pooping`, `dreamcatcher`, `is_grayscaling`, `social_energy_modifier`, `sex_drive`, `when_gather_prevent_gather`, `adventure_description`, `when_gather_apply_status_effect`, `when_gather_apply_status_effect_duration`, `physics`, `electronics`, `hacking`, `umbra`, `magic_binding`, `mining`) VALUES (532,0,0,0,2,0,0.35,0.72,0,0.66,0,2,0,0,0,0,"stealth",0,0,0,0,NULL,NULL,0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL,0,0,0,0,0,0) ON DUPLICATE KEY UPDATE `id` = `id`;

-- food effect
INSERT INTO item_food (`id`, `food`, `love`, `junk`, `alcohol`, `earthy`, `fruity`, `tannic`, `spicy`, `creamy`, `meaty`, `planty`, `fishy`, `floral`, `fatty`, `oniony`, `chemically`, `caffeine`, `psychedelic`, `granted_skill`, `chance_for_bonus_item`, `random_flavor`, `contains_tentacles`, `granted_status_effect`, `granted_status_effect_duration`, `is_candy`, `leftovers_id`, `bonus_item_group_id`) VALUES (538,4,-4,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,4,NULL,NULL,0,0,NULL,NULL,0,NULL,NULL) ON DUPLICATE KEY UPDATE `id` = `id`;

-- the item itself!
INSERT INTO item (`id`, `name`, `description`, `image`, `use_actions`, `tool_id`, `food_id`, `fertilizer`, `plant_id`, `hat_id`, `fuel`, `recycle_value`, `enchants_id`, `spice_id`, `treasure_id`, `is_bug`, `hollow_earth_tile_card_id`, `cannot_be_thrown_out`, `museum_points`) VALUES (1506,"Ill-gotten Grains",NULL,"veggie/ill-gotten-grains",'[["Rummage","illGottenGrains/#/rummage"]]',532,538,4,NULL,NULL,0,0,NULL,NULL,NULL,0,NULL,0,1) ON DUPLICATE KEY UPDATE `id` = `id`;

-- grammar
INSERT INTO item_grammar (`id`, `item_id`, `article`) VALUES (1587,1506,"some") ON DUPLICATE KEY UPDATE `id` = `id`;

-- item groups
INSERT IGNORE INTO item_group_item (item_group_id, item_id) VALUES (46, 1506);
EOSQL);
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs

}
}
70 changes: 70 additions & 0 deletions src/Controller/Item/IllGottenGrainsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Poppy Seed Pets API.
*
* The Poppy Seed Pets API is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* The Poppy Seed Pets API is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with The Poppy Seed Pets API. If not, see <https://www.gnu.org/licenses/>.
*/

namespace App\Controller\Item;

use App\Entity\Inventory;
use App\Exceptions\PSPInvalidOperationException;
use App\Functions\DateFunctions;
use App\Service\Clock;
use App\Service\InventoryService;
use App\Service\IRandom;
use App\Service\ResponseService;
use App\Service\TransactionService;
use App\Service\UserAccessor;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;

#[Route("/item/illGottenGrains")]
class IllGottenGrainsController
{
#[Route("/{inventory}/rummage", methods: ["POST"])]
#[IsGranted("IS_AUTHENTICATED_FULLY")]
public function consume(
Inventory $inventory,
ResponseService $responseService,
UserAccessor $userAccessor,
EntityManagerInterface $em,
Clock $clock,
IRandom $rng,
TransactionService $transactionService,
InventoryService $inventoryService
): JsonResponse
{
$user = $userAccessor->getUserOrThrow();

ItemControllerHelpers::validateInventory($user, $inventory, 'illGottenGrains/#/rummage');

if(DateFunctions::isCornMoon($clock->now))
return $responseService->itemActionSuccess('It seems the magic of the Corn Moon is preventing this morally-questionable item from being used!');

$location = $inventory->getLocation();
$lockedToOwner = $inventory->getLockedToOwner();

$em->remove($inventory);

$moneys = $rng->rngNextInt(4, 8);

$transactionService->getMoney($user, $moneys, 'Found in some Ill-gotten Grains.');

$inventoryService->receiveItem('Wheat', $user, $user, $user->getName() . ' got this from some Ill-gotten Grains.', $location, $lockedToOwner);

$em->flush();

$responseService->addFlashMessage('You rummage through the Ill-gotten Grains, finding some Wheat and ' . $moneys . '~~m~~.');

return $responseService->itemActionSuccess(null, [ 'itemDeleted' => true ]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private function exploreCellar(ComputedPetSkills $petWithSkills): PetActivityLog
$expStats = [ PetSkillEnum::Stealth ];

$item = ItemRepository::findOneByName($this->em, $this->rng->rngNextFromArray([
'Blood Wine', 'Chocolate Wine',
'Blood Wine', 'Chocolate Wine', 'Ill-gotten Grains'
]));

$loot[] = $item;
Expand All @@ -229,7 +229,7 @@ private function exploreCellar(ComputedPetSkills $petWithSkills): PetActivityLog
$expStats = [ PetSkillEnum::Stealth ];

$item = ItemRepository::findOneByName($this->em, $this->rng->rngNextFromArray([
'Blood Wine', 'Chocolate Wine',
'Blood Wine', 'Chocolate Wine', 'Ill-gotten Grains',
]));

$loot[] = $item;
Expand All @@ -247,7 +247,7 @@ private function exploreCellar(ComputedPetSkills $petWithSkills): PetActivityLog
$expStats = [ ];

$item = ItemRepository::findOneByName($this->em, $this->rng->rngNextFromArray([
'Blood Wine', 'Chocolate Wine',
'Blood Wine', 'Chocolate Wine', 'Ill-gotten Grains',
]));

$loot[] = $item;
Expand All @@ -261,7 +261,7 @@ private function exploreCellar(ComputedPetSkills $petWithSkills): PetActivityLog
$expAmount = 3;
$expStats = [ PetSkillEnum::Brawl ];

$loot[] = 'Chocolate Wine';
$loot[] = $this->rng->rngNextFromArray([ 'Chocolate Wine', 'Ill-gotten Grains' ]);
$tags[] = 'Fighting';

if($roll >= 25)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
use App\Enum\PetSkillEnum;
use App\Functions\AdventureMath;
use App\Functions\ArrayFunctions;
use App\Functions\DateFunctions;
use App\Functions\NumberFunctions;
use App\Functions\PetActivityLogFactory;
use App\Functions\PetActivityLogTagHelpers;
use App\Functions\PetBadgeHelpers;
use App\Model\ComputedPetSkills;
use App\Model\PetChanges;
use App\Service\Clock;
use App\Service\InventoryService;
use App\Service\IRandom;
use App\Service\PetActivity\IPetActivity;
Expand All @@ -45,8 +42,7 @@ public function __construct(
private readonly InventoryService $inventoryService,
private readonly PetExperienceService $petExperienceService,
private readonly IRandom $rng,
private readonly EntityManagerInterface $em,
private readonly Clock $clock
private readonly EntityManagerInterface $em
)
{
}
Expand Down Expand Up @@ -531,18 +527,16 @@ private function foundGiantCastle(ComputedPetSkills $petWithSkills): PetActivity

if($this->rng->rngSkillRoll($petWithSkills->getStealth()->getTotal() + $petWithSkills->getDexterity()->getTotal()) >= 20)
{
$wheatFlourOrCorn = DateFunctions::isCornMoon($this->clock->now) ? 'Corn' : 'Wheat Flour';

$possibleLoot = [
$wheatFlourOrCorn,
'Ill-gotten Grains',
'Gold Bar',
'Linens and Things',
'Pamplemousse',
'Fig',
'Slice of Bread',
'Stereotypical Bone',
'Puddin\' Rec\'pes',
'Gold Harp'
'Gold Harp',
];

$loot = [
Expand Down
Loading