mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
patch changes & fixes from master branch
remove VERSION file update rules add 33 migration add get_version_for_release.sh script update schema add use_character_sample_skills
This commit is contained in:
parent
a570363fe0
commit
2321cf84b0
2
CREDITS
2
CREDITS
@ -1,3 +1,3 @@
|
|||||||
* Gesior.pl (2007 - 2008)
|
* Gesior.pl (2007 - 2008)
|
||||||
* Slawkens (2009 - 2021)
|
* Slawkens (2009 - 2022)
|
||||||
* Contributors listed in CONTRIBUTORS.txt
|
* Contributors listed in CONTRIBUTORS.txt
|
||||||
|
@ -27,7 +27,7 @@ if (version_compare(phpversion(), '7.1', '<')) die('PHP version 7.1 or higher is
|
|||||||
|
|
||||||
const MYAAC = true;
|
const MYAAC = true;
|
||||||
const MYAAC_VERSION = '0.9.0-dev';
|
const MYAAC_VERSION = '0.9.0-dev';
|
||||||
const DATABASE_VERSION = 32;
|
const DATABASE_VERSION = 33;
|
||||||
const TABLE_PREFIX = 'myaac_';
|
const TABLE_PREFIX = 'myaac_';
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));
|
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||||
|
@ -164,6 +164,8 @@ $config = array(
|
|||||||
4 => 'Knight Sample'
|
4 => 'Knight Sample'
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'use_character_sample_skills' => false,
|
||||||
|
|
||||||
// it must show limited number of players after using search in character page
|
// it must show limited number of players after using search in character page
|
||||||
'characters_search_limit' => 15,
|
'characters_search_limit' => 15,
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SET @myaac_database_version = 32;
|
SET @myaac_database_version = 33;
|
||||||
|
|
||||||
CREATE TABLE `myaac_account_actions`
|
CREATE TABLE `myaac_account_actions`
|
||||||
(
|
(
|
||||||
@ -327,7 +327,7 @@ CREATE TABLE `myaac_spells`
|
|||||||
|
|
||||||
CREATE TABLE `myaac_visitors`
|
CREATE TABLE `myaac_visitors`
|
||||||
(
|
(
|
||||||
`ip` VARCHAR(16) NOT NULL,
|
`ip` VARCHAR(45) NOT NULL,
|
||||||
`lastvisit` INT(11) NOT NULL DEFAULT 0,
|
`lastvisit` INT(11) NOT NULL DEFAULT 0,
|
||||||
`page` VARCHAR(2048) NOT NULL,
|
`page` VARCHAR(2048) NOT NULL,
|
||||||
UNIQUE (`ip`)
|
UNIQUE (`ip`)
|
||||||
|
@ -11,7 +11,7 @@ server {
|
|||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
include snippets/fastcgi-php.conf;
|
include snippets/fastcgi-php.conf;
|
||||||
fastcgi_read_timeout 240;
|
fastcgi_read_timeout 240;
|
||||||
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
|
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ /\.ht {
|
location ~ /\.ht {
|
||||||
@ -22,4 +22,4 @@ server {
|
|||||||
deny all;
|
deny all;
|
||||||
return 404;
|
return 404;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ fi
|
|||||||
|
|
||||||
if [ $1 = "prepare" ]; then
|
if [ $1 = "prepare" ]; then
|
||||||
# define release version
|
# define release version
|
||||||
version=`cat VERSION`
|
version=`php system/get_version_for_release.php`
|
||||||
|
|
||||||
echo "Preparing to release version $version of the MyAAC Project!"
|
echo "Preparing to release version $version of the MyAAC Project!"
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ if [ $1 = "prepare" ]; then
|
|||||||
# get myaac from git archive
|
# get myaac from git archive
|
||||||
git archive --format zip --output tmp/myaac.zip master
|
git archive --format zip --output tmp/myaac.zip master
|
||||||
|
|
||||||
cd tmp/
|
cd tmp/ || exit
|
||||||
|
|
||||||
dir="myaac-$version"
|
dir="myaac-$version"
|
||||||
if [ -d "$dir" ] ; then
|
if [ -d "$dir" ] ; then
|
||||||
@ -41,9 +41,9 @@ fi
|
|||||||
|
|
||||||
if [ $1 = "pack" ]; then
|
if [ $1 = "pack" ]; then
|
||||||
# define release version
|
# define release version
|
||||||
version=`cat VERSION`
|
version=`php system/get_version_for_release.php`
|
||||||
|
|
||||||
cd tmp
|
cd tmp || exit
|
||||||
|
|
||||||
# tar.gz
|
# tar.gz
|
||||||
echo "Creating .tar.gz package.."
|
echo "Creating .tar.gz package.."
|
||||||
|
4
system/get_version_for_release.php
Normal file
4
system/get_version_for_release.php
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require __DIR__ . '/../common.php';
|
||||||
|
echo MYAAC_VERSION;
|
@ -193,8 +193,14 @@ class CreateCharacter
|
|||||||
$player->setManaSpent($char_to_copy->getManaSpent());
|
$player->setManaSpent($char_to_copy->getManaSpent());
|
||||||
$player->setSoul($char_to_copy->getSoul());
|
$player->setSoul($char_to_copy->getSoul());
|
||||||
|
|
||||||
for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++)
|
for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++) {
|
||||||
$player->setSkill($skill, 10);
|
$value = 10;
|
||||||
|
if (config('use_character_sample_skills')) {
|
||||||
|
$value = $char_to_copy->getSkill($skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
$player->setSkill($skill, $value);
|
||||||
|
}
|
||||||
|
|
||||||
$player->setLookBody($char_to_copy->getLookBody());
|
$player->setLookBody($char_to_copy->getLookBody());
|
||||||
$player->setLookFeet($char_to_copy->getLookFeet());
|
$player->setLookFeet($char_to_copy->getLookFeet());
|
||||||
@ -234,16 +240,22 @@ class CreateCharacter
|
|||||||
|
|
||||||
if($db->hasTable('player_skills')) {
|
if($db->hasTable('player_skills')) {
|
||||||
for($i=0; $i<7; $i++) {
|
for($i=0; $i<7; $i++) {
|
||||||
|
$value = 10;
|
||||||
|
if (config('use_character_sample_skills')) {
|
||||||
|
$value = $char_to_copy->getSkill($i);
|
||||||
|
}
|
||||||
$skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $i);
|
$skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $i);
|
||||||
if($skillExists->rowCount() <= 0) {
|
if($skillExists->rowCount() <= 0) {
|
||||||
$db->query('INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('.$player->getId().', '.$i.', 10, 0)');
|
$db->query('INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('.$player->getId().', '.$i.', ' . $value . ', 0)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
|
$loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
|
||||||
foreach($loaded_items_to_copy as $save_item)
|
foreach($loaded_items_to_copy as $save_item) {
|
||||||
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
|
$blob = $db->quote($save_item['attributes']);
|
||||||
|
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', $blob);");
|
||||||
|
}
|
||||||
|
|
||||||
global $twig;
|
global $twig;
|
||||||
$twig->display('success.html.twig', array(
|
$twig->display('success.html.twig', array(
|
||||||
|
@ -2489,7 +2489,7 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
|
|
||||||
$value = $this->db->query('SELECT ' . $this->db->fieldName('value') . ' FROM ' . $this->db->tableName('player_storage') . ' WHERE ' . $this->db->fieldName('key') . ' = ' . (int) $key . ' AND ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'])->fetch();
|
$value = $this->db->query('SELECT ' . $this->db->fieldName('value') . ' FROM ' . $this->db->tableName('player_storage') . ' WHERE ' . $this->db->fieldName('key') . ' = ' . (int) $key . ' AND ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'])->fetch();
|
||||||
|
|
||||||
if($value !== false)
|
if($value === false)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
6
system/migrations/33.php
Normal file
6
system/migrations/33.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
// Increase size of ip in myaac_visitors table
|
||||||
|
// according to this answer: https://stackoverflow.com/questions/166132/maximum-length-of-the-textual-representation-of-an-ipv6-address
|
||||||
|
// the size of ipv6 can be maximal 45 chars
|
||||||
|
|
||||||
|
$db->exec('ALTER TABLE `' . TABLE_PREFIX . "visitors` MODIFY `ip` VARCHAR(45) NOT NULL;");
|
@ -1,8 +1,2 @@
|
|||||||
{% if constant('PAGE') == 'rules' %}
|
|
||||||
<b>{{ config.lua.serverName }} Rules</b><br/>
|
<b>{{ config.lua.serverName }} Rules</b><br/>
|
||||||
<textarea rows="25" wrap="physical" cols="70" readonly="true">
|
{{ getCustomPage('rules_on_the_page') | nl2br }}
|
||||||
{% endif %}
|
|
||||||
{{ getCustomPage('rules_on_the_page') }}
|
|
||||||
{% if constant('PAGE') == 'rules' %}
|
|
||||||
</textarea>
|
|
||||||
{% endif %}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user