Update project structure

This commit is contained in:
Sky Johnson 2024-10-12 10:46:03 -05:00
parent a96752100a
commit 192533b1d3
19 changed files with 140 additions and 99 deletions

View File

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@

View File

@ -1,4 +1,43 @@
# Tooltip
# Dragon Knight
Below is the current project documentation.
## Attributes
### Power
Power is the attribute that determines overall strike damage. Damage from weapon attacks, spells, or other strikes and specific skills will be directly influenced by Power. Power is a linear measure, with 1 Power = 1 damage in most cases.
### Accuracy
Accuracy determines the chance your attack, spell, or other skill will actually land on your opponent.
### Penetration
Penetration as a value determines your ability to make it through physical defenses; i.e. the enemy's Toughness and Armor.
### Focus
Focus is the same as Penetration but for causing magical damage, and helps go through magical defenses; i.e. the enemy's Resist.
### Evasion
Evasion is the attribute responsible for determining your chance to dodge any kind of attack. When calculating the chance, at base every 2 Evasion is 0.1% chance. The enemy's Accuracy negatively impacts this stat. The chance to dodge is capped at 85%.
### Toughness
Toughness affects your health pool and baseline defensive capability to physical attacks, such as weapons, projectiles, and physical skills.
### Armor
Armor is an additional layer of physical protection over Toughness. All armor grants some level of Armor, and it's effect is linear; 1 Armor = 1 point of damage negated.
### Resist
Resist is your defensive capacity against magic such as spells, magic skills, and magic weapons. Like Armor, this is a linear stat.
### Precision
Precision determines your Uber (Critical) Hit chance. In general, 2 points of Precision = 0.1% chance. No matter how high this value, your Uber Hit chance caps at 90%. Some equipment grants straight Uber Hit chance.
### Ferocity
Ferocity is a linear modifier of your Uber Hit damage; 1 Ferocity = 1% Uber Hit damage. Uber Hit damage increases cap at 300%.
### Luck
Luck is a modifier for gained XP/Silver. Like Precision, 2 points of Luck = 0.1% increase of these gains.
## Tooltip
The tooltip library is Isotip, taken and modified by Sharkk! Here is the breakdown of the API.
@ -96,3 +135,62 @@ The positionTooltip method will re-evaluate the position of a tooltip in relatio
```javascript
Tooltip.positionTooltip( '.tooltip', '.tooltip-click', 'left' );
```
## CAPTCHA
Here is some example code for implementing a CAPTCHA, using the gd extension to create a server-rendered, randomized image.
```php
<?php
// Start the session to store the CAPTCHA answer
session_start();
// Define the image dimensions
$width = 200;
$height = 60;
// Create the image resource
$image = imagecreatetruecolor($width, $height);
// Define colors
$bg_color = imagecolorallocate($image, 255, 255, 255); // White background
$text_color = imagecolorallocate($image, 0, 0, 0); // Black text
$noise_color = imagecolorallocate($image, 100, 100, 100); // Gray for noise
// Fill the background
imagefill($image, 0, 0, $bg_color);
// Generate a random math equation (e.g., 3 + 5)
$num1 = rand(1, 9);
$num2 = rand(1, 9);
$operator = rand(0, 1) ? '+' : '-'; // Randomly choose addition or subtraction
$equation = "$num1 $operator $num2 = ?";
$answer = $operator == '+' ? ($num1 + $num2) : ($num1 - $num2);
// Store the answer in the session
$_SESSION['captcha'] = $answer;
// Add noise to the image (random dots)
for ($i = 0; $i < 1000; $i++) {
imagesetpixel($image, rand(0, $width), rand(0, $height), $noise_color);
}
// Set the path to the ZXX font
$font = __DIR__ . '/fonts/ZXX-Regular.ttf'; // Path to the ZXX font file
// Add the math equation using ZXX font
$font_size = 30;
$x = 20;
$y = 40;
imagettftext($image, $font_size, rand(-10, 10), $x, $y, $text_color, $font, $equation);
// Output the image as PNG
header('Content-Type: image/png');
imagepng($image);
// Free the image resource
imagedestroy($image);
?>
```
https://github.com/kawaiidesune/zxx

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +0,0 @@
# TODO
Currently, everything needs implemented.
First task is to finish building up the database structures.

View File

@ -1,34 +0,0 @@
# Attributes
## Power
Power is the attribute that determines overall strike damage. Damage from weapon attacks, spells, or other strikes and specific skills will be directly influenced by Power. Power is a linear measure, with 1 Power = 1 damage in most cases.
## Accuracy
Accuracy determines the chance your attack, spell, or other skill will actually land on your opponent.
## Penetration
Penetration as a value determines your ability to make it through physical defenses; i.e. the enemy's Toughness and Armor.
## Focus
Focus is the same as Penetration but for causing magical damage, and helps go through magical defenses; i.e. the enemy's Resist.
## Evasion
Evasion is the attribute responsible for determining your chance to dodge any kind of attack. When calculating the chance, at base every 2 Evasion is 0.1% chance. The enemy's Accuracy negatively impacts this stat. The chance to dodge is capped at 85%.
## Toughness
Toughness affects your health pool and baseline defensive capability to physical attacks, such as weapons, projectiles, and physical skills.
## Armor
Armor is an additional layer of physical protection over Toughness. All armor grants some level of Armor, and it's effect is linear; 1 Armor = 1 point of damage negated.
## Resist
Resist is your defensive capacity against magic such as spells, magic skills, and magic weapons. Like Armor, this is a linear stat.
## Precision
Precision determines your Uber (Critical) Hit chance. In general, 2 points of Precision = 0.1% chance. No matter how high this value, your Uber Hit chance caps at 90%. Some equipment grants straight Uber Hit chance.
## Ferocity
Ferocity is a linear modifier of your Uber Hit damage; 1 Ferocity = 1% Uber Hit damage. Uber Hit damage increases cap at 300%.
## Luck
Luck is a modifier for gained XP/Silver. Like Precision, 2 points of Luck = 0.1% increase of these gains.

View File

@ -1,56 +0,0 @@
Here is some example code for implementing a CAPTCHA, using the gd extension to create a server-rendered, randomized image.
```php
<?php
// Start the session to store the CAPTCHA answer
session_start();
// Define the image dimensions
$width = 200;
$height = 60;
// Create the image resource
$image = imagecreatetruecolor($width, $height);
// Define colors
$bg_color = imagecolorallocate($image, 255, 255, 255); // White background
$text_color = imagecolorallocate($image, 0, 0, 0); // Black text
$noise_color = imagecolorallocate($image, 100, 100, 100); // Gray for noise
// Fill the background
imagefill($image, 0, 0, $bg_color);
// Generate a random math equation (e.g., 3 + 5)
$num1 = rand(1, 9);
$num2 = rand(1, 9);
$operator = rand(0, 1) ? '+' : '-'; // Randomly choose addition or subtraction
$equation = "$num1 $operator $num2 = ?";
$answer = $operator == '+' ? ($num1 + $num2) : ($num1 - $num2);
// Store the answer in the session
$_SESSION['captcha'] = $answer;
// Add noise to the image (random dots)
for ($i = 0; $i < 1000; $i++) {
imagesetpixel($image, rand(0, $width), rand(0, $height), $noise_color);
}
// Set the path to the ZXX font
$font = __DIR__ . '/fonts/ZXX-Regular.ttf'; // Path to the ZXX font file
// Add the math equation using ZXX font
$font_size = 30;
$x = 20;
$y = 40;
imagettftext($image, $font_size, rand(-10, 10), $x, $y, $text_color, $font, $equation);
// Output the image as PNG
header('Content-Type: image/png');
imagepng($image);
// Free the image resource
imagedestroy($image);
?>
```
https://github.com/kawaiidesune/zxx

View File

@ -1,3 +0,0 @@
# Items
Items consists of all item types in the game; useless flavor items, gear, consumables, etc.

View File

@ -21,6 +21,8 @@ body {
background-attachment: fixed;
background-position: center top;
background-repeat: no-repeat;
max-width: 1920px;
margin: 0px auto;
}
.ui.button {
@ -135,6 +137,7 @@ aside {
.box {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 0.15rem;
padding: 0.5rem;
}
}

View File

@ -41,6 +41,16 @@ router_post($r, '/character/delete', 'char_controller_delete_post');
router_get($r, '/world', 'world_controller_get');
router_post($r, '/move', 'world_controller_move_post');
/*
Settings
*/
router_get($r, '/settings', 'settings_controller_get');
/*
Auctions
*/
router_get($r, '/auctions', 'auctions_controller_get');
/*
Router
*/

View File

@ -23,6 +23,8 @@ require_once SRC . '/model/char.php';
require_once SRC . '/controller/char.php';
require_once SRC . '/controller/auth.php';
require_once SRC . '/controller/world.php';
require_once SRC . '/controller/settings.php';
require_once SRC . '/controller/auctions.php';
// Track the start time of the request
define('START_TIME', microtime(true));

View File

@ -0,0 +1,9 @@
<?php
function auctions_controller_get()
{
auth_only();
$GLOBALS['active_nav_tab'] = 'auctions';
echo render('layouts/basic', ['view' => 'pages/auctions/index']);
}

View File

@ -0,0 +1,9 @@
<?php
function settings_controller_get()
{
auth_only();
$GLOBALS['active_nav_tab'] = 'settings';
echo render('layouts/basic', ['view' => 'pages/settings/index']);
}

View File

@ -37,7 +37,9 @@
<aside id="right">
<?php if (user()): ?>
// right nav
<div class="box">
@TODO
</div>
<?php endif; ?>
</aside>
</main>

View File

@ -0,0 +1,2 @@
<h1>Auctions</h1>
<p>@TODO</p>

View File

@ -0,0 +1,2 @@
<h1>Settings</h1>
<p>@TODO</p>