Skip to content

Commit

Permalink
Merge branch 'release/1.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Chakratos committed Jul 3, 2024
2 parents fbc578e + 5be0f1f commit 4226113
Show file tree
Hide file tree
Showing 22 changed files with 38,010 additions and 37,798 deletions.
2 changes: 2 additions & 0 deletions app/Controller/CharacterController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static function Edit(Character $character)
$zenny = SaveDataController::GetZenny($decompressed);
$itembox = SaveDataController::GetItembox($decompressed);
$equipbox = SaveDataController::GetEquipmentBox($decompressed);
$itempouch = SaveDataController::GetItemPouch($decompressed)['items'];
$ammopouch = SaveDataController::GetItemPouch($decompressed)['ammo'];

$gZenny = SaveDataController::GetGZenny($decompressed);
$cp = SaveDataController::GetCP($decompressed);
Expand Down
6 changes: 4 additions & 2 deletions app/Controller/SaveDataController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,21 @@ public static function GetItemPouch(string $saveData)
$br->setPosition(0x23E74);

$items = ['items' => [], 'ammo' => []];
for ($i = 0; $i <= 20 ; $i++) {
for ($i = 0; $i < 20 ; $i++) {
$item = new Item($br->readBytes(8));
if ($item->getId() === "0000") {
continue;
}
$item->setSlot($i);
$items['items'][] = $item;
}

for ($i = 0; $i <= 10 ; $i++) {
for ($i = 0; $i < 10 ; $i++) {
$item = new Item($br->readBytes(8));
if ($item->getId() === "0000") {
continue;
}
$item->setSlot($i);
$items['ammo'][] = $item;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
/**
*
*/
class RoadShopController extends AbstractController
class ShopController extends AbstractController
{
protected static string $itemName = 'roadshop';
protected static string $itemName = 'shop';
protected static string $itemClass = ShopItem::class;
/**
* @return void
Expand All @@ -27,15 +27,19 @@ public static function Index(): void

$data = [];

$roadItems = EM::getInstance()->getRepository(self::$itemClass)->matching(
Criteria::create()->where(Criteria::expr()->eq('shop_type', '10'))
$shopItems = EM::getInstance()->getRepository(self::$itemClass)->matching(
Criteria::create()->where(Criteria::expr()->gt('shop_type', '0'))
)->toArray();

$modalFieldInfo = [
$UILocale['ID'] => [
'type' => 'Hidden',
'disabled' => true,
],
$UILocale['Shop Type'] => [
'type' => 'Array',
'options' => ShopItem::$shoptypes,
],
$UILocale['Category'] => [
'type' => 'Array',
'options' => ShopItem::$categories,
Expand All @@ -45,17 +49,18 @@ public static function Index(): void
'options' => ItemsService::getForLocale(),
],
$UILocale['Cost'] => ['type' => 'Int', 'min' => 1, 'max' => 999, 'placeholder' => '1-999'],
$UILocale['GRank Req'] => ['type' => 'Int', 'min' => 1, 'max' => 999, 'placeholder' => '1-999'],
$UILocale['GRank Req'] => ['type' => 'Int', 'min' => 0, 'max' => 999, 'placeholder' => '0-999'],
$UILocale['Trade Quantity'] => ['type' => 'Int', 'min' => 1, 'max' => 999, 'placeholder' => '1-999'],
$UILocale['Maximum Quantity'] => ['type' => 'Int', 'min' => 1, 'max' => 999, 'placeholder' => '1-999'],
$UILocale['Road Floors Req'] => ['type' => 'Int', 'min' => 1, 'max' => 999, 'placeholder' => '1-999'],
$UILocale['Weekly Fatalis Kills'] => ['type' => 'Int', 'min' => 1, 'max' => 999, 'placeholder' => '1-999'],
$UILocale['Maximum Quantity'] => ['type' => 'Int', 'min' => 0, 'max' => 999, 'placeholder' => '0-999'],
$UILocale['Road Floors Req'] => ['type' => 'Int', 'min' => 0, 'max' => 999, 'placeholder' => '0-999'],
$UILocale['Weekly Fatalis Kills'] => ['type' => 'Int', 'min' => 0, 'max' => 999, 'placeholder' => '0-999'],
];

$fieldPositions = [
'headline' => $UILocale['ID'],
[

$UILocale['Shop Type'],
$UILocale['Category'],
$UILocale['Item'],
],
Expand All @@ -69,34 +74,41 @@ public static function Index(): void
],
];

foreach ($roadItems as $roadItem) {
$itemId = self::numberConvertEndian($roadItem->getItemid(), 2);
foreach ($shopItems as $shopItem) {
$itemId = self::numberConvertEndian($shopItem->getItemid(), 2);
$itemData = ItemsService::getForLocale()[$itemId];
$data[] = [
$UILocale['ID'] => $roadItem->getId(),
$UILocale['ID'] => $shopItem->getId(),

$UILocale['Shop Type'] =>
[
'id' => $shopItem->getShoptype(),
'name' => $shopItem->getShoptypeFancy(),
],

$UILocale['Category'] =>
[
'id' => $roadItem->getShopid(),
'name' => $roadItem->getShopidFancy(),
'id' => $shopItem->getShopid(),
'name' => $shopItem->getShopidFancy(),
],
$UILocale['Item'] =>
[
'id' => $itemId,
'name' => $itemData['name'] ? : $UILocale['No Translation!'],
],
$UILocale['Cost'] => $roadItem->getCost(),
$UILocale['GRank Req'] => $roadItem->getMinGr(),
$UILocale['Trade Quantity'] => $roadItem->getQuantity(),
$UILocale['Maximum Quantity'] => $roadItem->getMaxQuantity(),
$UILocale['Road Floors Req'] => $roadItem->getRoadFloors(),
$UILocale['Weekly Fatalis Kills'] => $roadItem->getRoadFatalis(),
$UILocale['Cost'] => $shopItem->getCost(),
$UILocale['GRank Req'] => $shopItem->getMinGr(),
$UILocale['Trade Quantity'] => $shopItem->getQuantity(),
$UILocale['Maximum Quantity'] => $shopItem->getMaxQuantity(),
$UILocale['Road Floors Req'] => $shopItem->getRoadFloors(),
$UILocale['Weekly Fatalis Kills'] => $shopItem->getRoadFatalis(),
];
}

$actions = [
];

echo EditorGeneratorService::generateDynamicTable('MHF Road Shop', static::$itemName, $modalFieldInfo, $fieldPositions, $data, $actions);
echo EditorGeneratorService::generateDynamicTable('MHF Shop', static::$itemName, $modalFieldInfo, $fieldPositions, $data, $actions);
}


Expand All @@ -106,7 +118,7 @@ public static function Index(): void
* @throws ORMException
* @throws OptimisticLockException
*/
public static function EditRoadShopItem(): void
public static function EditShopItem(): void
{
self::SaveItem(static function ($item) {
$item->setItemid(hexdec(self::numberConvertEndian(hexdec($_POST[self::localeWS('Item')]), 2)));
Expand All @@ -118,7 +130,7 @@ public static function EditRoadShopItem(): void
$item->setRoadFloors($_POST[self::localeWS('Road Floors Req')]);
$item->setRoadFatalis($_POST[self::localeWS('Weekly Fatalis Kills')]);

$item->setShoptype(10);
$item->setShoptype($_POST[self::localeWS('Shop Type')]);
$item->setMinHr(0);
$item->setMinSr(0);
$item->setStoreLevel(1);
Expand All @@ -128,7 +140,7 @@ public static function EditRoadShopItem(): void
/**
* @return void
*/
public static function ExportRoadShopItems(): void
public static function ExportShopItems(): void
{

$records = EM::getInstance()->getRepository(self::$itemClass)->matching(
Expand All @@ -142,7 +154,7 @@ public static function ExportRoadShopItems(): void
* @throws ORMException
* @throws OptimisticLockException
*/
public static function ImportRoadShopItems(): void
public static function ImportShopItems(): void
{
self::importFromCSV('n.shop_type = 10');
}
Expand Down
Loading

0 comments on commit 4226113

Please sign in to comment.