Log in

View Full Version : Character Browser 2.1, Magelo clone, character mover, dynamic sigs


airtalking
12-15-2009, 10:30 PM
I added the signature builder. It lets you build a custom signature for your toons and generates the BBcode to paste in. The signatures will automatically graphically update whenever you level/change gear.

I *think* I fixed some firefox display problems

I added an alternative method for displaying dynamic fonts in images for servers without freetype installed, it is significantly lower quality though. Kind of a beggars can't be choosers situation. This will fix the dynamic title image on the front, and help pages. It is also figured into the signature pages. If freetype is available the font size dropdown boxes will be available on the signature builder page. They will be disabled if freetype is unavailable. The old method of putting up fonts does not include dynamic font sizes. This will cause some issues getting everything to fit just right on your signatures... sorry. More GDF fonts can be added by simple pasting them into the fontsold directory. Same thing goes for new fonts, background images, alpha layers... basically any of the images/fonts associated with the signature builder will automatically be added to the tool if an admin pastes them in the correct directory.

Character mover is added. It escapes all strings put into the database. All old strings for chracacter and guild searches are very strictly filtered to only allow letters, or numbers. This should keep the tool pretty safe to use which is important cause the character mover requires the DB account to now have UPDATE privelages. To combat login account name guesses I have it sleep for 2 seconds when it gets a name wrong. If someone has suggestions for added security please post away.
The character mover will let the server admin enable multiple receiving zones, and will enable the moving of multiple characters at once. Also you can SAVE the move in the form of a favorite/bookmark to let you easily repeat it again in the future. The tool exists to help people who are stuck... but everyone uses it to travel too, its no secret =). If you just hate the bookmark feature I'll leave it up to you to add in the session variable stuff.


I moved the profile navigation buttons to a sidebar so they will be available on every page now. If you notice they don't show up sometimes when an error message is posted its a known issue, and i'm considering it a system limitation cause it would require significant changes to fix it. On the sidebar I added a "move" button to autopopulate a charmove with this toons name, and a "LINK" button that will bookmark that toons profile for you.

The toon bookmark buttons, and charmove bookmark buttons may not function for you in Chrome, just gonna have to do it the old fashion way, i didn't get to coding a work around for chrome.


If you find a security hole or something please PM it to me, and give me 48 hours to respond and tell people with it installed about and then post it publicly for anyone else I missed. In all likelyhood a "hotfix" can get put together and sent out to most of the server admins within an hour or two.

I put up a server and tested out the char mover out a little and it worked fine. DO ensure that your server has mod rewrite enabled for the signatures to work properly.

You know where to find it, if not google.

bad_captain
10-30-2010, 03:06 PM
Earlier this week, I posted changes to allow Bots to be viewed with CharBrowser. I have now added support for the new SoD HP, Mana, and Endurance calculations. The only thing I don't like about this code is that I had to pass in the $useSoDHPManaEnd variable to the functions, as I could not get them access to the variable I set in the config file even after including it in the calculatestats.php file. If anyone knows how to fix that, please let me know. Thanks! Oh, also, this will turn on the new calculations for everyone using the system, even if they use Titanium, but I assume anyone who would use this would be using a private server and would know if they are using SoD =).

Here are the changes.

/include/config.php

in the General Settings section, add rule for using SoD calcs

$useSoDHPManaEnd = 0 ;//use SoD calcs 0=no 1=yes




/include/calculatestats.php

add function GetClassHPFactor

//function copied/converted from EQEMU sourcecode oct 26, 2010
function GetClassHPFactor($class) {

$multiplier = 0;

$WARRIOR = 1;
$CLERIC = 2;
$PALADIN = 3;
$RANGER = 4;
$SHADOWKNIGHT = 5;
$DRUID = 6;
$MONK = 7;
$BARD = 8;
$ROGUE = 9;
$SHAMAN = 10;
$NECROMANCER = 11;
$WIZARD = 12;
$MAGICIAN = 13;
$ENCHANTER = 14;
$BEASTLORD = 15;
$BERSERKER = 16;


switch($class)
{
case $DRUID:
case $ENCHANTER:
case $NECROMANCER:
case $MAGICIAN:
case $WIZARD:
$multiplier = 240;
break;
case $BEASTLORD:
case $BERSERKER:
case $MONK:
case $ROGUE:
case $SHAMAN:
$multiplier = 255;
break;
case $BARD:
case $CLERIC:
$multiplier = 264;
break;
case $SHADOWKNIGHT:
case $PALADIN:
$multiplier = 288;
break;
case $RANGER:
$multiplier = 276;
break;
case $WARRIOR:
$multiplier = 300;
break;
default:
$multiplier = 240;
break;
}
return $multiplier;
}


replace GetMaxHP

//function copied/converted from EQEMU sourcecode oct 26, 2010
function GetMaxHP($mlevel,$class,$sta,$ihp,$useSoDHPManaEnd )
{
if($useSoDHPManaEnd == 1)
{
$SoDPost255 = 0;

if((($sta- 255) / 2) > 0)
$SoDPost255 = (($sta- 255) / 2);
else
$SoDPost255 = 0;

$hp_factor = GetClassHPFactor($class);

if ($mlevel < 41) {
$base_hp = (5 + ($mlevel * $hp_factor / 12) +
(($sta- $SoDPost255) * $level * $hp_factor / 3600));
}
else if ($mlevel < 81) {
$base_hp = (5 + (40 * hp_factor / 12) + (($mlevel - 40) * $hp_factor / 6) +
(($sta- $SoDPost255) * $hp_factor / 90) +
(($sta- $SoDPost255) * ($mlevel - 40) * $hp_factor / 1800));
}
else {
$base_hp = (5 + (80 * $hp_factor / 8) + (($mlevel - 80) * $hp_factor / 10) +
(($sta- $SoDPost255) * $hp_factor / 90) +
(($sta- $SoDPost255) * $hp_factor / 45));
}

$base_hp += $ihp;
}
else
{
$lm = GetClassLevelFactor($mlevel,$class);
$Post255 = 0;
if(($sta-255)/2 > 0)
$Post255 = ($sta-255)/2;
else
$Post255 = 0;

$base_hp = (5)+($mlevel*$lm/10) + ((($sta-$Post255)*$mlevel*$lm/3000)) + (($Post255*$mlevel)*$lm/6000);

$base_hp += $ihp;
}

return floor($base_hp);
}


replace GetMaxMana

//function copied/converted from EQEMU sourcecode oct 26, 2010, was named CalcMaxMana();
function GetMaxMana($level,$class,$int,$wis,$imana,$useSoDH PManaEnd)
{
$WisInt = 0;
$MindLesserFactor = 0;
$MindFactor = 0;
$max_m = 0;
$wisint_mana = 0;
$base_mana = 0;
$ConvertedWisInt = 0;
switch(GetCasterClass($class))
{
case 'I':
$WisInt = $int;

if($useSoDHPManaEnd == 1)
{
if ($WisInt > 100) {
$ConvertedWisInt = ((($WisInt - 100) * 5 / 2) + 100);
if ($WisInt > 201) {
$ConvertedWisInt -= (($WisInt - 201) * 5 / 4);
}
}
else {
$ConvertedWisInt = $WisInt;
}
if ($level < 41) {
$wisint_mana = ($level * 75 * $ConvertedWisInt / 1000);
$base_mana = ($level * 15);
}
else if ($level < 81) {
$wisint_mana = ((3 * $ConvertedWisInt) + (($level - 40) * 15 * $ConvertedWisInt / 100));
$base_mana = (600 + (($level - 40) * 30));
}
else {
$wisint_mana = (9 * $ConvertedWisInt);
$base_mana = (1800 + (($level - 80) * 18));
}
$max_mana = $base_mana + $wisint_mana;
$max_mana += $imana;
}
else
{
if((( $WisInt - 199 ) / 2) > 0)
$MindLesserFactor = ( $WisInt - 199 ) / 2;
else
$MindLesserFactor = 0;

$MindFactor = $WisInt - $MindLesserFactor;
if($WisInt > 100)
$max_mana = (((5 * ($MindFactor + 20)) / 2) * 3 * $level / 40);
else
$max_mana = (((5 * ($MindFactor + 200)) / 2) * 3 * $level / 100);
$max_mana += $imana;
}
break;

case 'W':
$WisInt = $wis;

if($useSoDHPManaEnd == 1)
{
if ($WisInt > 100) {
$ConvertedWisInt = ((($WisInt - 100) * 5 / 2) + 100);
if ($WisInt > 201) {
$ConvertedWisInt -= (($WisInt - 201) * 5 / 4);
}
}
else {
$ConvertedWisInt = $WisInt;
}
if ($level < 41) {
$wisint_mana = ($level * 75 * $ConvertedWisInt / 1000);
$base_mana = ($level * 15);
}
else if ($level < 81) {
$wisint_mana = ((3 * $ConvertedWisInt) + (($level - 40) * 15 * $ConvertedWisInt / 100));
$base_mana = (600 + (($level - 40) * 30));
}
else {
$wisint_mana = (9 * $ConvertedWisInt);
$base_mana = (1800 + (($level - 80) * 18));
}
$max_mana = $base_mana + $wisint_mana;
$max_mana += $imana;
}
else
{
if((( $WisInt - 199 ) / 2) > 0)
$MindLesserFactor = ( $WisInt - 199 ) / 2;
else
$MindLesserFactor = 0;

$MindFactor = $WisInt - $MindLesserFactor;
if($WisInt > 100)
$max_mana = (((5 * ($MindFactor + 20)) / 2) * 3 * $level / 40);
else
$max_mana = (((5 * ($MindFactor + 200)) / 2) * 3 * $level / 100);

$max_mana += $imana;
}
break;

case 'N': {
$max_mana = 0;
break;
}

}

return floor($max_mana);
}


replace GetMaxEndurance

//function copied/converted from EQEMU sourcecode oct 26, 2010
function GetMaxEndurance($STR,$STA,$DEX,$AGI,$level,$iendur ance,$useSoDHPManaEnd)
{
if ($useSoDHPManaEnd == 1)
{
$Stats = ($STR + $STA + $DEX + $AGI)/4;
$base_endurance = 0;
$ConvertedStats = 0;
$sta_end = 0;

if (($Stats) > 100) {
$ConvertedStats = ((($Stats - 100) * 5 / 2) + 100);
if ($Stats > 201) {
$ConvertedStats -= (($Stats - 201) * 5 / 4);
}
}
else {

$ConvertedStats = $Stats;
}

if ($level < 41) {
$sta_end = ($level * 75 * $ConvertedStats / 1000);
$base_endurance = ($level * 15);
}
else if ($level < 81) {
$sta_end = ((3 * $ConvertedStats) + (($level - 40) * 15 * $ConvertedStats / 100));
$base_endurance = (600 + (($level - 40) * 30));
}
else {
$sta_end = (9 * $ConvertedStats);
$base_endurance = (1800 + (($level - 80) * 18));
}
$max_end = ($base_endurance + $sta_end);
}
else
{
$Stats = $STR + $STA + $DEX + $AGI;
$LevelBase = $level * 15;

$at_most_800 = $Stats;
if($at_most_800 > 800)
$at_most_800 = 800;

$Bonus400to800 = 0;
$HalfBonus400to800 = 0;
$Bonus800plus = 0;
$HalfBonus800plus = 0;

$BonusUpto800 = floor( $at_most_800 / 4 ) ;
if($Stats > 400) {
$Bonus400to800 = floor( ($at_most_800 - 400) / 4 );
$HalfBonus400to800 = floor( max( ( $at_most_800 - 400 ), 0 ) / 8 );

if($Stats > 800) {
$Bonus800plus = floor( ($Stats - 800) / 8 ) * 2;
$HalfBonus800plus = floor( ($Stats - 800) / 16 );
}
}
$bonus_sum = $BonusUpto800 + $Bonus400to800 + $HalfBonus400to800 + $Bonus800plus + $HalfBonus800plus;

$max_end = $LevelBase;

//take all of the sums from above, then multiply by level*0.075
$max_end += ( $bonus_sum * 3 * $level ) / 40;
}

$max_end += $iendurance;
return floor($max_end);
}




/bot.php

within $template->assign_vars(array()), add parameter to GetMaxHP, GetMaxMana, and GetMaxEndurance that determines whether or not to use SoD calcs

'HP' => GetMaxHP($level,$botclass,($baseSTA+$itemstats->STA()),$itemstats->hp(),$useSoDHPManaEnd),
'MANA' => GetMaxMana($level,$botclass,($baseINT+$itemstats->INT()),($baseWIS+$itemstats->WIS()),+$itemstats->mana(),$useSoDHPManaEnd),
'ENDR' => GetMaxEndurance(($baseSTR+$itemstats->STR()),($baseSTA+$itemstats->STA()),($baseDEX+$itemstats->DEX()),($baseAGI+$itemstats->AGI()),$level,$itemstats->endurance(),$useSoDHPManaEnd),




/character.php

within $template->assign_vars(array()), add parameters to GetManHP, GetMaxMana, GetMaxEndurance

'HP' => GetMaxHP($level,$class,($baseSTA+$itemstats->STA()),$itemstats->hp(),$useSoDHPManaEnd),
'MANA' => GetMaxMana($level,$class,($baseINT+$itemstats->INT()),($baseWIS+$itemstats->WIS()),+$itemstats->mana(),$useSoDHPManaEnd),
'ENDR' => GetMaxEndurance(($baseSTR+$itemstats->STR()),($baseSTA+$itemstats->STA()),($baseDEX+$itemstats->DEX()),($baseAGI+$itemstats->AGI()),$level,$itemstats->endurance(),$useSoDHPManaEnd),