-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3.3 First pass of multi tenancy, first pass for bots
Setup the multi tenancy for every page except the bazaar. If you're using it, you'll need to disable the bazaar for now. Did a first pass of displaying bots. There is a "bots" button in the side menu now which will display a gallery of a characters bots. You can click the bot to see their gear. The AC/HP/Mana/End/Atk are not accurate right now. Will be addressed in the future.
- Loading branch information
Showing
33 changed files
with
1,951 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
<?php | ||
/*************************************************************************** | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Portions of this program are derived from publicly licensed software | ||
* projects including, but not limited to phpBB, Magelo Clone, | ||
* EQEmulator, EQEditor, and Allakhazam Clone. | ||
* | ||
* Author: | ||
* Maudigan(Airwalking) | ||
* | ||
* April 17, 2020 - initial revision (Maudigan) | ||
* April 25, 2020 - Maudigan | ||
* implement multi-tenancy | ||
* | ||
***************************************************************************/ | ||
|
||
|
||
/********************************************* | ||
INCLUDES | ||
*********************************************/ | ||
define('INCHARBROWSER', true); | ||
include_once(__DIR__ . "/include/common.php"); | ||
include_once(__DIR__ . "/include/bot_profile.php"); | ||
include_once(__DIR__ . "/include/profile.php"); | ||
include_once(__DIR__ . "/include/itemclass.php"); | ||
include_once(__DIR__ . "/include/db.php"); | ||
|
||
|
||
/********************************************* | ||
SETUP PROFILE/PERMISSIONS | ||
*********************************************/ | ||
if(!$_GET['bot']) cb_message_die($language['MESSAGE_ERROR'],$language['MESSAGE_NO_CHAR']); | ||
else $botName = $_GET['bot']; | ||
|
||
//bot initializations | ||
$bot = new bot_profile($botName, $cbsql, $cbsql_content, $language, $charbrowser_is_admin_page); //the profile class will sanitize the bot name | ||
$charID = $bot->char_id(); | ||
$botID = $bot->bot_id(); | ||
$botName = $bot->GetValue('name'); | ||
|
||
//char initialization | ||
$tpl = <<<TPL | ||
SELECT name | ||
FROM character_data | ||
WHERE id = '%s' | ||
TPL; | ||
$query = sprintf($tpl, $charID); | ||
$result = $cbsql->query($query); | ||
if (!($row = $cbsql->nextrow($result))) cb_message_die($language['MESSAGE_ERROR'],$language['MESSAGE_NO_CHAR']); | ||
$charName = $row['name']; | ||
$char = new profile($charName, $cbsql, $cbsql_content, $language, $showsoftdelete, $charbrowser_is_admin_page); | ||
$mypermission = GetPermissions($char->GetValue('gm'), $char->GetValue('anon'), $char->char_id()); | ||
|
||
//block view if user level doesnt have permission | ||
if ($mypermission['bots']) cb_message_die($language['MESSAGE_ERROR'],$language['MESSAGE_ITEM_NO_VIEW']); | ||
|
||
|
||
/********************************************* | ||
GATHER RELEVANT PAGE DATA | ||
*********************************************/ | ||
//get bot info | ||
$class = $bot->GetValue('class'); | ||
|
||
|
||
/********************************************* | ||
DROP HEADER | ||
*********************************************/ | ||
$d_title = " - ".$botName.$language['PAGE_TITLES_CHARACTER']; | ||
include(__DIR__ . "/include/header.php"); | ||
|
||
|
||
/********************************************* | ||
DROP PROFILE MENU | ||
*********************************************/ | ||
output_profile_menu($charName, 'bot'); | ||
|
||
|
||
/********************************************* | ||
POPULATE BODY | ||
*********************************************/ | ||
$cb_template->set_filenames(array( | ||
'bot' => 'bot_body.tpl') | ||
); | ||
|
||
|
||
$cb_template->assign_both_vars(array( | ||
'NAME' => $charName, | ||
'REGEN' => number_format($bot->getRegen()), | ||
'FT' => number_format($bot->getFT()), | ||
'DS' => number_format($bot->getDS()), | ||
'HASTE' => $bot->getHaste(), | ||
'DELETED' => (($char->GetValue('deleted_at')) ? " ".$language['CHAR_DELETED']:""), | ||
'FIRST_NAME' => $botName, | ||
'LAST_NAME' => $bot->GetValue('last_name'), | ||
'TITLE' => $bot->GetValue('title'), | ||
'LEVEL' => $bot->GetValue('level'), | ||
'CLASS' => $dbclassnames[$class], | ||
'RACE' => $dbracenames[$bot->GetValue('race')], | ||
'RACE_ID' => $bot->GetValue('race'), | ||
'GENDER_ID' => $bot->GetValue('gender'), | ||
'FACE_ID' => $bot->GetValue('face'), | ||
'AVATAR_IMG' => getAvatarImage($bot->GetValue('race'), $bot->GetValue('gender'), $bot->GetValue('face')), | ||
'CLASS_NUM' => $class, | ||
'DEITY' => $dbdeities[$bot->GetValue('deity')], | ||
'HP' => number_format($bot->GetItemHP()), | ||
'MANA' => number_format($bot->GetItemMana()), | ||
'ENDR' => number_format($bot->GetItemEndurance()), | ||
'AC' => number_format($bot->GetItemAC()), | ||
'ATK' => number_format($bot->GetItemATK()), | ||
'STR' => number_format($bot->getSTR()), | ||
'STA' => number_format($bot->getSTA()), | ||
'DEX' => number_format($bot->getDEX()), | ||
'AGI' => number_format($bot->getAGI()), | ||
'INT' => number_format($bot->getINT()), | ||
'WIS' => number_format($bot->getWIS()), | ||
'CHA' => number_format($bot->getCHA()), | ||
'HSTR' => number_format($bot->getHSTR()), | ||
'HSTA' => number_format($bot->getHSTA()), | ||
'HDEX' => number_format($bot->getHDEX()), | ||
'HAGI' => number_format($bot->getHAGI()), | ||
'HINT' => number_format($bot->getHINT()), | ||
'HWIS' => number_format($bot->getHWIS()), | ||
'HCHA' => number_format($bot->getHCHA()), | ||
'POISON' => $bot->getPR(), | ||
'FIRE' => $bot->getFR(), | ||
'MAGIC' => $bot->getMR(), | ||
'DISEASE' => $bot->getDR(), | ||
'COLD' => $bot->getCR(), | ||
'CORRUPT' => $bot->getCOR(), | ||
'HPOISON' => $bot->getHPR(), | ||
'HFIRE' => $bot->getHFR(), | ||
'HMAGIC' => $bot->getHMR(), | ||
'HDISEASE' => $bot->getHDR(), | ||
'HCOLD' => $bot->getHCR(), | ||
'HCORRUPT' => $bot->getHCOR(), | ||
'WEIGHT' => round($bot->getWT()/10)) | ||
); | ||
|
||
$cb_template->assign_vars(array( | ||
'L_HEADER_INVENTORY' => $language['CHAR_INVENTORY'], | ||
'L_REGEN' => $language['CHAR_REGEN'], | ||
'L_FT' => $language['CHAR_FT'], | ||
'L_DS' => $language['CHAR_DS'], | ||
'L_HASTE' => $language['CHAR_HASTE'], | ||
'L_HP' => $language['CHAR_HP'], | ||
'L_MANA' => $language['CHAR_MANA'], | ||
'L_ENDR' => $language['CHAR_ENDR'], | ||
'L_AC' => $language['CHAR_AC'], | ||
'L_ATK' => $language['CHAR_ATK'], | ||
'L_STR' => $language['CHAR_STR'], | ||
'L_STA' => $language['CHAR_STA'], | ||
'L_DEX' => $language['CHAR_DEX'], | ||
'L_AGI' => $language['CHAR_AGI'], | ||
'L_INT' => $language['CHAR_INT'], | ||
'L_WIS' => $language['CHAR_WIS'], | ||
'L_CHA' => $language['CHAR_CHA'], | ||
'L_HSTR' => $language['CHAR_HSTR'], | ||
'L_HSTA' => $language['CHAR_HSTA'], | ||
'L_HDEX' => $language['CHAR_HDEX'], | ||
'L_HAGI' => $language['CHAR_HAGI'], | ||
'L_HINT' => $language['CHAR_HINT'], | ||
'L_HWIS' => $language['CHAR_HWIS'], | ||
'L_HCHA' => $language['CHAR_HCHA'], | ||
'L_POISON' => $language['CHAR_POISON'], | ||
'L_MAGIC' => $language['CHAR_MAGIC'], | ||
'L_DISEASE' => $language['CHAR_DISEASE'], | ||
'L_FIRE' => $language['CHAR_FIRE'], | ||
'L_COLD' => $language['CHAR_COLD'], | ||
'L_CORRUPT' => $language['CHAR_CORRUPT'], | ||
'L_HPOISON' => $language['CHAR_HPOISON'], | ||
'L_HMAGIC' => $language['CHAR_HMAGIC'], | ||
'L_HDISEASE' => $language['CHAR_HDISEASE'], | ||
'L_HFIRE' => $language['CHAR_HFIRE'], | ||
'L_HCOLD' => $language['CHAR_HCOLD'], | ||
'L_HCORRUPT' => $language['CHAR_HCORRUPT'], | ||
'L_WEIGHT' => $language['CHAR_WEIGHT'], | ||
'L_DONE' => $language['BUTTON_DONE']) | ||
); | ||
|
||
//--------------------------------- | ||
// SLOTS TEMPLATE VARS | ||
//--------------------------------- | ||
//EQUIPMENT | ||
for ( $i = SLOT_EQUIPMENT_START; $i <= SLOT_EQUIPMENT_END; $i++ ) { | ||
$cb_template->assign_block_vars("equipslots", array( | ||
'SLOT' => $i) | ||
); | ||
} | ||
|
||
|
||
//--------------------------------- | ||
// ITEM ICONS TEMPLATE VARS | ||
//--------------------------------- | ||
$allitems = $bot->getAllItems(); | ||
|
||
|
||
//EQUIPMENT | ||
foreach ($allitems as $value) { | ||
if ($value->type() != EQUIPMENT) continue; | ||
$cb_template->assign_block_vars("equipitem", array( | ||
'SLOT' => $value->slot(), | ||
'ICON' => $value->icon(), | ||
'STACK' => $value->stack()) | ||
); | ||
} | ||
|
||
|
||
//--------------------------------- | ||
// ITEM WINDOW TEMPLATE VARS | ||
//--------------------------------- | ||
//the item inspect windows that hold | ||
//the item stats. this does equipment, | ||
//inventory, bank and shared bank | ||
foreach ($allitems as $value) { | ||
$cb_template->assign_both_block_vars("item", array( | ||
'SLOT' => $value->slot(), | ||
'ICON' => $value->icon(), | ||
'NAME' => $value->name(), | ||
'STACK' => $value->stack(), | ||
'ID' => $value->id(), | ||
'LINK' => QuickTemplate($link_item, array('ITEM_ID' => $value->id())), | ||
'HTML' => $value->html()) | ||
); | ||
for ( $i = 0 ; $i < $value->augcount() ; $i++ ) { | ||
$cb_template->assign_both_block_vars("item.augment", array( | ||
'AUG_NAME' => $value->augname($i), | ||
'AUG_ID' => $value->augid($i), | ||
'AUG_LINK' => QuickTemplate($link_item, array('ITEM_ID' => $value->augid($i))), | ||
'AUG_ICON' => $value->augicon($i), | ||
'AUG_HTML' => $value->aughtml($i)) | ||
); | ||
} | ||
} | ||
|
||
|
||
/********************************************* | ||
OUTPUT BODY AND FOOTER | ||
*********************************************/ | ||
$cb_template->pparse('bot'); | ||
|
||
$cb_template->destroy; | ||
|
||
include(__DIR__ . "/include/footer.php"); | ||
?> |
Oops, something went wrong.