Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(shop): Merge "Shop Features" into develop #1172

Merged
merged 160 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
ec5c0f3
Merge branch 'master' of https://github.com/corowne/lorekeeper into s…
ScuffedNewt Nov 19, 2020
cfe20b1
adding admin only shops
ScuffedNewt Nov 19, 2020
f03d81f
stashing for tomorrow -> backend for limited by items missing
ScuffedNewt Nov 19, 2020
2dfef62
limits backend
ScuffedNewt Nov 19, 2020
f9c6320
shop limit complete and small aesthetic changes
ScuffedNewt Nov 20, 2020
01ff205
adding view for limited shops
ScuffedNewt Nov 20, 2020
7beb483
start of coupons
ScuffedNewt Nov 20, 2020
d526f3a
coupons tag complete, need purchase backend
ScuffedNewt Nov 22, 2020
312b3a5
coupons finished i hope there's no bugs lol
ScuffedNewt Nov 22, 2020
2946fd4
hotfix
ScuffedNewt Nov 22, 2020
697f6e0
adding protection to free items
ScuffedNewt Nov 22, 2020
9177dc8
adding infinite tags and settings option
ScuffedNewt Nov 23, 2020
9fc667d
hotfix
ScuffedNewt Nov 23, 2020
a4442c5
hotfix
ScuffedNewt Nov 23, 2020
643f9e2
adding FTO only shops & stock
ScuffedNewt Nov 26, 2020
183a434
changing order of abort 404 (thanks uri)
ScuffedNewt Jan 10, 2021
893f746
adding some error reporting
ScuffedNewt Jan 30, 2021
8b02dee
choose if you can use coupons on limited stock items
ScuffedNewt Jan 31, 2021
a5aca93
changing the description
ScuffedNewt Jan 31, 2021
854156f
adding modified shops
ScuffedNewt Sep 2, 2021
b0518d0
Merge branch 'release/release-2.0.0' of https://github.com/corowne/lo…
ScuffedNewt Sep 2, 2021
92421d5
fix purchase limit & eager loading
ScuffedNewt Sep 2, 2021
0264f44
add credit & more detailed stock info
ScuffedNewt Sep 2, 2021
8a529da
add count
ScuffedNewt Sep 2, 2021
8dfb434
no message
ScuffedNewt Oct 13, 2021
98b856a
Merge branch 'shop-features-save' into extension/shop-features
ScuffedNewt Oct 13, 2021
cd025df
fix log
ScuffedNewt Oct 14, 2021
1eb0eb8
fix logs
ScuffedNewt Oct 14, 2021
9b1a4f6
add visibility to shop items
ScuffedNewt Dec 15, 2021
eb2bd90
fix wording
ScuffedNewt Dec 15, 2021
4733fad
fix(shops): staff shops visible in ext item info
itinerare Dec 28, 2021
4e2f7f2
Merge pull request #23 from itinerare/extension/shop-features
ScuffedNewt Dec 28, 2021
e61149a
add collapsible shops
ScuffedNewt Jan 25, 2022
0d0c26c
fix log cost
ScuffedNewt Jan 25, 2022
af65cd5
add restocking to shops
ScuffedNewt Feb 6, 2022
56a1702
fix kernal schedule
ScuffedNewt Feb 6, 2022
8cbfda1
fix: purchase limites not being recognised due to cost changes
ScuffedNewt Feb 14, 2022
e3ed560
add disallow transfer option
ScuffedNewt Mar 1, 2022
a488af8
feat: Add coupon allowance selection
ScuffedNewt Mar 17, 2022
f73b2ee
Update extension_tracker.php
SpeedyD Mar 25, 2022
a3456c4
Merge pull request #58 from SpeedyD/patch-1
ScuffedNewt Mar 25, 2022
9ccc99f
Purchase Limit Timeframe
May 17, 2022
1c6cf97
Fix naming on the dropdown
Jun 14, 2022
f66c142
Show timeframe on main shop page
Jun 15, 2022
6784f56
Merge branch 'extension/shop-features' of https://github.com/Ne-wt/lo…
Jul 10, 2022
4752da7
Fixes
Jul 10, 2022
fcdef84
Merge pull request #103 from AW0005/extension/timed-shop-refresh-with…
ScuffedNewt Jul 12, 2022
4f9baad
no message
Sep 28, 2022
5c2e27b
updating main branch finally
Mar 6, 2023
fac2214
Merge branch 'extension/shop-features' of https://github.com/Ne-wt/lo…
Mar 7, 2023
3b0d561
no message
Mar 7, 2023
dfe7a99
no message
Mar 7, 2023
2281249
no message
Mar 7, 2023
933db92
no message
Mar 7, 2023
061921f
no message
Mar 7, 2023
442e0b1
add stock/shops that can cycle in/out even with no specific end/start
Mar 19, 2023
bd4580b
Merge pull request #201 from CH3RVB/timed-stock
ScuffedNewt Mar 29, 2023
33fbb47
fix(shop): Fixed 500 error if guests try to enter a shop with a restr…
SpeedyD Apr 30, 2023
70d8c9a
upd(exttracker): forgot version number
SpeedyD Apr 30, 2023
d5836f8
Merge pull request #213 from SpeedyD/patch/shop-features-guest-restri…
ScuffedNewt May 1, 2023
a92d736
Merge branch 'main' of https://github.com/corowne/lorekeeper into ext…
ScuffedNewt Jun 4, 2023
b6be230
refactor alt shop stock types
ScuffedNewt Jun 4, 2023
97bd083
add is visible pivot to shop stock relation
ScuffedNewt Jul 20, 2023
2602f4d
make shops more compatible
ScuffedNewt Jul 23, 2023
c8fba0b
pull & run before dev to make merge conflicts more manageable
ScuffedNewt Dec 27, 2023
55a6acc
update format.sh to recurse properly
ScuffedNewt Jan 13, 2024
e2ba35f
Merge branch 'pre-dev-merge' of https://github.com/Ne-wt/lorekeeper i…
ScuffedNewt Jan 17, 2024
5c5aaf4
format on shop views
ScuffedNewt Jan 17, 2024
cc8bf51
Merge branch 'extension/shop-features' into release/v3.0.0
ScuffedNewt Jan 17, 2024
057ff70
refactor: fix blade formatting
Jan 17, 2024
f3d6aec
feat: creation of basic limits, todo dynamic limits and evaluation
ScuffedNewt Jul 20, 2024
3df4e9e
refactor: wording
ScuffedNewt Jul 20, 2024
31e4a84
refactor: fix blade formatting
ScuffedNewt Jul 20, 2024
61246b6
stash
ScuffedNewt Jul 24, 2024
ee557d4
refactor: fix blade formatting
ScuffedNewt Jul 24, 2024
71f3a0a
refactor: fix PHP styling
ScuffedNewt Jul 24, 2024
d8da5ef
stash
ScuffedNewt Aug 7, 2024
792763b
hotfix: Fix monthly limit on shop stocks
preimpression Aug 18, 2024
9743c90
refactor: fix PHP styling
preimpression Aug 18, 2024
31c5566
feat(limits): default limits done, debitting, shops, submissions
ScuffedNewt Aug 19, 2024
aa50c1e
refactor: fix blade formatting
ScuffedNewt Aug 19, 2024
e3107af
refactor: fix PHP styling
ScuffedNewt Aug 19, 2024
cd11b5e
feat(dynamic limits): complete dynamic limits
ScuffedNewt Aug 19, 2024
0b8ae3e
Merge branch 'extension/dynamic-limits' of https://github.com/scuffed…
ScuffedNewt Aug 19, 2024
49ee1d0
refactor: fix blade formatting
ScuffedNewt Aug 19, 2024
69100a9
refactor: fix PHP styling
ScuffedNewt Aug 19, 2024
1e59d14
feat(nit): view cleanupp
ScuffedNewt Aug 19, 2024
adf5404
Merge branch 'extension/dynamic-limits' of https://github.com/scuffed…
ScuffedNewt Aug 19, 2024
398361f
refactor: fix blade formatting
ScuffedNewt Aug 19, 2024
b043155
fix(nit): spelling
ScuffedNewt Aug 19, 2024
1a83cdc
feat(shops): add to stock modal too just in case
ScuffedNewt Aug 19, 2024
d6b067a
Merge branch 'develop' of https://github.com/corowne/lorekeeper into …
ScuffedNewt Sep 3, 2024
245f218
Merge branch 'extension/dynamic-limits' of https://github.com/Ne-wt/l…
ScuffedNewt Sep 3, 2024
21de0fc
fix(shops): restore disallow transfer
ScuffedNewt Sep 3, 2024
51bb5d6
fix: disallow transfers
ScuffedNewt Sep 3, 2024
9e8e4a5
refactor: fix PHP styling
ScuffedNewt Sep 3, 2024
4e0b568
fix: ordering of debits sometimes throwing undefined array
ScuffedNewt Sep 4, 2024
31484af
refactor: fix blade formatting
ScuffedNewt Sep 4, 2024
8cf87d1
Merge branch 'extension/dynamic-limits' of https://github.com/Ne-wt/l…
ScuffedNewt Sep 4, 2024
68a2fab
fix: fix limits additions and checkboxes
ScuffedNewt Sep 4, 2024
7f970cb
fix: disallow transfer
ScuffedNewt Sep 4, 2024
4e6e271
refactor: fix blade formatting
ScuffedNewt Sep 4, 2024
19725b4
refactor: fix PHP styling
ScuffedNewt Sep 4, 2024
1f042de
feat(userowned)
ScuffedNewt Sep 4, 2024
1815360
display Cancel button if claim
Oct 2, 2024
32b2578
feat: make costs variable
ScuffedNewt Nov 25, 2024
0116763
refactor: fix blade formatting
ScuffedNewt Nov 25, 2024
b2afe90
Merge pull request #262 from rattusquo/extension/shop-features
ScuffedNewt Nov 25, 2024
67b3347
Merge branch 'develop' of https://github.com/corowne/lorekeeper into …
ScuffedNewt Nov 25, 2024
ee22f63
refactor: fix PHP styling
ScuffedNewt Nov 25, 2024
5cd59d9
fix: stock items having no image
ScuffedNewt Nov 25, 2024
5dc637e
Merge branch 'extension/shop-features' of https://github.com/scuffedn…
ScuffedNewt Nov 25, 2024
daf043f
feat: add hidden shops
ScuffedNewt Nov 25, 2024
2800403
fix: save file
ScuffedNewt Nov 25, 2024
db6ae9e
refactor: fix blade formatting
ScuffedNewt Nov 25, 2024
0a51e43
refactor: fix PHP styling
ScuffedNewt Nov 25, 2024
9abb80c
fix: timed stock
ScuffedNewt Nov 25, 2024
ab61422
Merge branch 'extension/shop-features' of https://github.com/scuffedn…
ScuffedNewt Nov 25, 2024
82b8dbd
fix: remove biweekly
ScuffedNewt Nov 25, 2024
d00a9be
feat: random restocks and repeatable timed shops / stock
ScuffedNewt Nov 25, 2024
36a10c0
refactor: fix PHP styling
ScuffedNewt Nov 25, 2024
d9b0470
refactor: fix blade formatting
ScuffedNewt Nov 25, 2024
0d4491b
fix: add currency model trace
ScuffedNewt Nov 29, 2024
c7c1d57
refactor: fix PHP styling
ScuffedNewt Nov 29, 2024
417131c
fix: item held count
ScuffedNewt Nov 29, 2024
4afad17
Fix quantity not appearing on admin stock editing modal
SpeedyD Dec 1, 2024
bc3b3e8
Capitalize Auth
SpeedyD Dec 1, 2024
4b91338
Add hash to Shop model
SpeedyD Dec 1, 2024
5e35d70
Fix Extension Tracker
SpeedyD Dec 1, 2024
895fee5
Merge pull request #264 from SpeedyD/fix-alt/shop-features
ScuffedNewt Dec 1, 2024
a40237c
fix(shops index): Capitalized more Auth
SpeedyD Dec 1, 2024
15d01bc
Merge pull request #265 from SpeedyD/fix-alt/another-auth
ScuffedNewt Dec 12, 2024
9deb775
fix: free items not having limits
ScuffedNewt Dec 18, 2024
494d272
refactor: fix PHP styling
ScuffedNewt Dec 18, 2024
823b2f6
fix: update tab to match
ScuffedNewt Dec 19, 2024
2eb2c51
fix: totalcost if assets dont have indexing, make indexing default on…
ScuffedNewt Dec 19, 2024
798779d
refactor: fix PHP styling
ScuffedNewt Dec 19, 2024
7b96eac
fix: displayCosts using indexing
ScuffedNewt Dec 19, 2024
4dee0c6
Merge branch 'extension/shop-features' of https://github.com/scuffedn…
ScuffedNewt Dec 19, 2024
6a1b897
fix: deleting currency stock checks
ScuffedNewt Dec 19, 2024
d0d96fe
fix: shops not charging correct quantity when multiple units purchased
ScuffedNewt Dec 21, 2024
367065d
fix: logs
ScuffedNewt Dec 21, 2024
8e1a031
fix: display stocktype in shop logs
ScuffedNewt Dec 21, 2024
bd9b01e
refactor: fix blade formatting
ScuffedNewt Dec 21, 2024
6a47dbd
refactor: fix PHP styling
ScuffedNewt Dec 21, 2024
9d25524
fix: deleted costs
ScuffedNewt Dec 21, 2024
63d9961
refactor: fix PHP styling
ScuffedNewt Dec 21, 2024
e71caa9
fix: purchase limits not respected for multiple quantities
ScuffedNewt Dec 23, 2024
5d0fb85
Merge branch 'extension/shop-features' of https://github.com/scuffedn…
ScuffedNewt Dec 23, 2024
ac4c534
refactor: fix PHP styling
ScuffedNewt Dec 23, 2024
272f963
feat: add coupons to logs
ScuffedNewt Jan 12, 2025
ae20fef
fix: restore .env.example
ScuffedNewt Jan 12, 2025
db83f60
feat: add credits
ScuffedNewt Jan 12, 2025
65eebd6
refactor: fix PHP styling
ScuffedNewt Jan 12, 2025
666a300
Merge branch 'develop' of https://github.com/corowne/lorekeeper into …
ScuffedNewt Jan 15, 2025
8c1f672
refactor: fix PHP styling
ScuffedNewt Jan 15, 2025
b4db6a4
fix: item->shop relations
ScuffedNewt Jan 16, 2025
31c9580
Merge branch 'extension/shop-features' of https://github.com/scuffedn…
ScuffedNewt Jan 16, 2025
5989262
refactor: fix PHP styling
ScuffedNewt Jan 16, 2025
07d9311
fix(items): add get to shop query
ScuffedNewt Jan 16, 2025
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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
6 changes: 6 additions & 0 deletions app/Console/Commands/AddSiteSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public function handle() {

$this->addSiteSetting('comment_dislikes_enabled', 0, '0: Dislikes disabled, 1: Dislikes enabled.');

$this->addSiteSetting('shop_type', 0, '0: Default, 1: Collapsible.');

$this->addSiteSetting('coupon_settings', 0, '0: Percentage is taken from total (e.g 20% from 2 items costing a total of 100 = 80), 1: Percentage is taken from item (e.g 20% from 2 items costing a total of 100 = 90)');

$this->addSiteSetting('limited_stock_coupon_settings', 0, '0: Does not allow coupons to be used on limited stock items, 1: Allows coupons to be used on limited stock items');

$this->addSiteSetting('can_transfer_currency_directly', 1, 'Whether or not users can directly transfer currency to other users without trading. 0: Users cannot directly transfer currency. 1: Direct currency transfers are allowed.');

$this->addSiteSetting('can_transfer_items_directly', 1, 'Whether or not users can directly transfer items to other users without trading. 0: Users cannot directly transfer items. 1: Direct item transfers are allowed.');
Expand Down
58 changes: 58 additions & 0 deletions app/Console/Commands/ConvertShopLimits.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace App\Console\Commands;

use App\Models\Limit\Limit;
use DB;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;

class ConvertShopLimits extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'convert-shop-limits';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Converts existing shop limits to the new system.';

/**
* Execute the console command.
*/
public function handle() {
if (!Schema::hasTable('shop_limits')) {
$this->info('No shop limits to convert.');

return;
}

$shopLimits = DB::table('shop_limits')->get();
$bar = $this->output->createProgressBar(count($shopLimits));
$bar->start();
foreach ($shopLimits as $shopLimit) {
Limit::create([
'object_model' => 'App\Models\Shop\Shop',
'object_id' => $shopLimit->shop_id,
'limit_type' => 'item',
'limit_id' => $shopLimit->item_id,
'quantity' => 1,
]);

$bar->advance();
}
$bar->finish();

// drop the is_restricted column from the shops table
Schema::table('shops', function ($table) {
$table->dropColumn('is_restricted');
});

Schema::dropIfExists('shop_limits');
}
}
81 changes: 81 additions & 0 deletions app/Console/Commands/RestockShops.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

namespace App\Console\Commands;

use App\Models\Shop\ShopStock;
use Carbon\Carbon;
use Illuminate\Console\Command;

class RestockShops extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'restock-shops';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Restocks shops.';

/**
* Create a new command instance.
*/
public function __construct() {
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle() {
$stocks = ShopStock::where('is_limited_stock', 1)->where('restock', 1)->get();
foreach ($stocks as $stock) {
if ($stock->restock_interval == 2) {
// check if it's start of week
$now = Carbon::now();
$day = $now->dayOfWeek;
if ($day != 1) {
continue;
}
} elseif ($stock->restock_interval == 3) {
// check if it's start of month
$now = Carbon::now();
$day = $now->day;
if ($day != 1) {
continue;
}
}

// if the stock is random, restock from the stock type
if ($stock->isRandom) {
$type = $stock->stock_type;
$model = getAssetModelString(strtolower($type));
if (method_exists($model, 'visible')) {
$itemId = $stock->categoryId ?
$model::visible()->where(strtolower($type).'_category_id', $stock->categoryId)->inRandomOrder()->first()->id :
$model::visible()->inRandomOrder()->first()->id;
} elseif (method_exists($model, 'released')) {
$itemId = $stock->categoryId ?
$model::released()->where(strtolower($type).'_category_id', $stock->categoryId)->inRandomOrder()->first()->id :
$model::released()->inRandomOrder()->first()->id;
} else {
$itemId = $stock->categoryId ?
$model::where(strtolower($type).'_category_id', $stock->categoryId)->inRandomOrder()->first()->id :
$model::inRandomOrder()->first()->id;
}

$stock->item_id = $itemId;
$stock->save();
}

$stock->quantity = $stock->range ? mt_rand(1, $stock->restock_quantity) : $stock->restock_quantity;
$stock->save();
}
}
}
74 changes: 74 additions & 0 deletions app/Console/Commands/UpdateTimedStock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

namespace App\Console\Commands;

use App\Models\Shop\Shop;
use App\Models\Shop\ShopStock;
use Illuminate\Console\Command;

class UpdateTimedStock extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update-timed-stock';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Hides timed stock or shops when expired, or sets it active if ready.';

/**
* Create a new command instance.
*/
public function __construct() {
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle() {
$hidestock = ShopStock::where('is_timed_stock', 1)->where('is_visible', 1)->get()->filter(function ($stock) {
return !$stock->isActive;
});
$showstock = ShopStock::where('is_timed_stock', 1)->where('is_visible', 0)->get()->filter(function ($stock) {
return $stock->isActive;
});

// set stock that should be active to active
foreach ($showstock as $showstock) {
$showstock->is_visible = 1;
$showstock->save();
}
// hide stock that should be hidden now
foreach ($hidestock as $hidestock) {
$hidestock->is_visible = 0;
$hidestock->save();
}

// also activate or deactivate the shops
$hideshop = Shop::where('is_timed_shop', 1)->where('is_active', 1)->get()->filter(function ($shop) {
return !$shop->isActive;
});
$showshop = Shop::where('is_timed_shop', 1)->where('is_active', 0)->get()->filter(function ($shop) {
return $shop->isActive;
});

// set shop that should be active to active
foreach ($showshop as $showshop) {
$showshop->is_active = 1;
$showshop->save();
}
// hide shop that should be hidden now
foreach ($hideshop as $hideshop) {
$hideshop->is_active = 0;
$hideshop->save();
}
}
}
4 changes: 4 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ protected function schedule(Schedule $schedule) {
->daily();
$schedule->command('update-staff-reward-actions')
->daily();
$schedule->command('restock-shops')
->daily();
$schedule->command('update-timed-stock')
->everyMinute();
}

/**
Expand Down
Loading
Loading