Add T4 Hero System (configurable on install)

Add T4 Hero System (configurable on install with TRUE/FALS) part of #285

-Adventures
-Merchants
-Equipment
This commit is contained in:
novgorodschi catalin
2026-07-10 09:15:42 +03:00
parent ed325b6d99
commit 3c99623a33
46 changed files with 4367 additions and 32 deletions
+72
View File
@@ -951,6 +951,8 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%hero` (
`level` tinyint(3) NULL,
`points` int(3) NULL,
`experience` int(11) NULL,
`silver` int(11) NOT NULL DEFAULT 0,
`production` tinyint(1) NOT NULL DEFAULT 0,
`dead` tinyint(1) NULL,
`health` float(12,9) NULL,
`attack` tinyint(3) NULL,
@@ -976,6 +978,76 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%hero` (
-- --------------------------------------------------------
--
-- Table structure for table `%prefix%hero_items` (T4 hero port)
--
CREATE TABLE IF NOT EXISTS `%PREFIX%hero_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`heroid` int(11) NOT NULL DEFAULT 0,
`itemid` smallint(5) NOT NULL,
`slot` tinyint(2) NOT NULL DEFAULT 0,
`stat_value` int(11) NOT NULL DEFAULT 0,
`quantity` int(11) NOT NULL DEFAULT 1,
`equipped` tinyint(1) NOT NULL DEFAULT 0,
`tstamp` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `uid_equipped` (`uid`,`equipped`),
KEY `uid_slot` (`uid`,`slot`),
KEY `itemid` (`itemid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `%prefix%hero_adventure` (T4 hero port)
--
CREATE TABLE IF NOT EXISTS `%PREFIX%hero_adventure` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`wref` int(11) NOT NULL DEFAULT 0,
`difficulty` tinyint(1) NOT NULL DEFAULT 0,
`duration` int(11) NOT NULL DEFAULT 0,
`created` int(11) NOT NULL DEFAULT 0,
`expire` int(11) NOT NULL DEFAULT 0,
`status` tinyint(1) NOT NULL DEFAULT 0,
`moveid` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `uid_status` (`uid`,`status`),
KEY `expire` (`expire`),
KEY `moveid` (`moveid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `%prefix%auction` (T4 hero port)
--
CREATE TABLE IF NOT EXISTS `%PREFIX%auction` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seller` int(11) NOT NULL DEFAULT 0,
`itemid` smallint(5) NOT NULL,
`slot` tinyint(2) NOT NULL DEFAULT 0,
`stat_value` int(11) NOT NULL DEFAULT 0,
`quantity` int(11) NOT NULL DEFAULT 1,
`silver_start` int(11) NOT NULL DEFAULT 0,
`silver_current` int(11) NOT NULL DEFAULT 0,
`bidder` int(11) NOT NULL DEFAULT 0,
`bid_max` int(11) NOT NULL DEFAULT 0,
`created` int(11) NOT NULL DEFAULT 0,
`time_end` int(11) NOT NULL DEFAULT 0,
`status` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `status_end` (`status`,`time_end`),
KEY `bidder` (`bidder`),
KEY `seller` (`seller`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
+27
View File
@@ -0,0 +1,27 @@
<?php
#################################################################################
# Regenerates css/hero_items.css from GameEngine/Data/hero_items.php so the #
# sprite grid can never drift from the catalog. Run from the repo root: #
# php var/tools/generate_hero_sprites.php #
# Grid contract: img/hero/items.png is a 16-column sheet of 32x32 cells in #
# CATALOG ORDER. Replace the PNG with real art on the same grid and rerun #
# nothing - only rerun this script when the CATALOG changes. #
#################################################################################
define('TB_PREFIX', 'x');
include __DIR__ . '/../../GameEngine/Data/hero_items.php';
$cell = 48; $cols = 16; $idx = 0;
$css = "/* AUTO-GENERATED from GameEngine/Data/hero_items.php - regenerate via var/tools/generate_hero_sprites.php\n"
. " Placeholder art: replace img/hero/items.png with real 48x48 sprites on the SAME grid\n"
. " (16 columns, catalog order) and this CSS keeps working unchanged. */\n"
. ".heroT4Item{display:inline-block;width:48px;height:48px;vertical-align:middle;\n"
. " background-image:url('../img/hero/items.png');background-repeat:no-repeat;}\n";
foreach ($heroItemCatalog as $iid => $def) {
$x = ($idx % $cols) * $cell;
$y = intdiv($idx, $cols) * $cell;
$css .= ".heroT4Item.item{$iid}{background-position:-{$x}px -{$y}px;} /* {$def['name']} */\n";
$idx++;
}
file_put_contents(__DIR__ . '/../../css/hero_items.css', $css);
echo "css/hero_items.css written: $idx items\n";