mirror of
https://github.com/slawkens/myaac.git
synced 2026-01-11 17:11:30 +01:00
Fix for servers that don't have the cap & conditions columns
This commit is contained in:
@@ -35,6 +35,7 @@ $skills = array(
|
||||
$hasBlessingsColumn = $db->hasColumn('players', 'blessings');
|
||||
$hasBlessingColumn = $db->hasColumn('players', 'blessings1');
|
||||
$hasLookAddons = $db->hasColumn('players', 'lookaddons');
|
||||
$hasCapColumn = $db->hasColumn('players', 'cap');
|
||||
|
||||
$skull_type = array("None", "Yellow", "Green", "White", "Red", "Black", "Orange");
|
||||
?>
|
||||
@@ -167,8 +168,11 @@ else if (isset($_REQUEST['search'])) {
|
||||
$town = $_POST['town'];
|
||||
verify_number($town, 'Town', 11);
|
||||
|
||||
if ($hasCapColumn) {
|
||||
$capacity = $_POST['capacity'];
|
||||
verify_number($capacity, 'Capacity', 11);
|
||||
}
|
||||
|
||||
$sex = $_POST['sex'];
|
||||
verify_number($sex, 'Sex', 1);
|
||||
|
||||
@@ -282,7 +286,11 @@ else if (isset($_REQUEST['search'])) {
|
||||
$player->setPosZ($pos_z);
|
||||
$player->setSoul($soul);
|
||||
$player->setTownId($town);
|
||||
|
||||
if ($hasCapColumn) {
|
||||
$player->setCap($capacity);
|
||||
}
|
||||
|
||||
$player->setSex($sex);
|
||||
$player->setLastLogin($lastlogin);
|
||||
$player->setLastLogout($lastlogout);
|
||||
@@ -561,10 +569,12 @@ else if (isset($_REQUEST['search'])) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<?php if($hasCapColumn): ?>
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
<label for="capacity" class="control-label">Capacity:</label>
|
||||
<input type="text" class="form-control" id="capacity" name="capacity" autocomplete="off" size="3" maxlength="11" value="<?php echo $player->getCap(); ?>"/>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
<label for="soul" class="control-label">Soul:</label>
|
||||
<input type="text" class="form-control" id="soul" name="soul" autocomplete="off" size="3" maxlength="10" value="<?php echo $player->getSoul(); ?>"/>
|
||||
|
||||
@@ -1390,12 +1390,7 @@ class OTS_Player extends OTS_Row_DAO
|
||||
*/
|
||||
public function getCap()
|
||||
{
|
||||
if( !isset($this->data['cap']) )
|
||||
{
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
|
||||
return $this->data['cap'];
|
||||
return $this->data['cap'] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,7 +149,10 @@ class CreateCharacter
|
||||
if($db->hasColumn('players', 'direction'))
|
||||
$player->setDirection($playerSample->getDirection());
|
||||
|
||||
if($db->hasColumn('players', 'conditions')) {
|
||||
$player->setConditions($playerSample->getConditions());
|
||||
}
|
||||
|
||||
$rank = $playerSample->getRank();
|
||||
if($rank->isLoaded()) {
|
||||
$player->setRank($playerSample->getRank());
|
||||
@@ -183,7 +186,11 @@ class CreateCharacter
|
||||
$player->setLookHead($playerSample->getLookHead());
|
||||
$player->setLookLegs($playerSample->getLookLegs());
|
||||
$player->setLookType($playerSample->getLookType());
|
||||
|
||||
if($db->hasColumn('players', 'cap')) {
|
||||
$player->setCap($playerSample->getCap());
|
||||
}
|
||||
|
||||
$player->setBalance(0);
|
||||
$player->setPosX(0);
|
||||
$player->setPosY(0);
|
||||
|
||||
Reference in New Issue
Block a user