Archive > AoC 0.6.x Custom/Unofficial modules

AoC attribute trickle-down/stats calculator module

(1/3) > >>

heljeere:
Here's a little module I've made that calculates the actual gains from stat changes.

It's based on the information found here: http://community.ageofconan.com/wsp/conan/frontend.cgi?func=publish.show&template=content&func_id=2904&table=CONTENT

Usage:

--- Code: ---!attribute <attribute name> <value>
--- End code ---

Examples:

--- Code: ---!attribute int 100
!attribute Wisdom 67
--- End code ---

Module code:

--- Code: ---<?php
  /*
   * Attribute.php - An Age of Conan attribute calculator Module
   * For BeBot - An Anarchy Online & Age of Conan Chat Automaton Developed by Blondengy (RK1)
   * Copyright (C) 2009 Daniel Holmen
   *
   * As usual place this file in ./modules
   */
   
  /*
    Add a "_" at the beginning of the file (_Attribute.php) if you do not want it to be loaded.
  */

$attribute = new Attribute($bot);

class Attribute Extends BaseActiveModule
{
var $bot;
var $attribute;
var $returnstr;

/*
* Constructor:
* Hands over a referance to the "Bot" class.
*/
function __construct (&$bot)
{
parent::__construct(&$bot, get_class($this));

$this -> register_command("all", "attribute", "MEMBER");

$this -> help['description'] = 'Attribute trickle-down calculator';
$this -> help['command']['dummy'] = "";
}

function command_handler($name, $msg, $origin)
{
$output = "";
if (strtolower($msg) == "attribute")
{
$output = $this->generate_list();
}
else if (preg_match("/^attribute.*$/i", $msg))
{
// Handle arguments
$cmdparam = explode(" ", $msg);

$attr = $this->get_attribute_name($cmdparam[1]);
if ($attr == "") return "No such attribute name";

$output = $this->generate_list($attr, $cmdparam[2]);
}
else $output = "Invalid arguments";

return $output;
}

function get_attribute_name($name)
{
$aliases = array(
"int" => "Intelligence",
"con" => "Constitution",
"str" => "Strength",
"dex" => "Dexterity",
"wis" => "Wisdom"
);

$lowercasename = trim(strtolower($name));
foreach($aliases as $key => $value)
{
if ($lowercasename == $key) return $value;
if ($lowercasename == strtolower($value)) return $value;


return "";
}

function generate_list($attr, $value)
{
$output = "<font face='HEADLINE' color=#c0c0c0>" . $value . " " . $attr . "</font><br>";
$linktitle = "Calculated values for ".$value." ".$attr." (Click for info)";

$infolist = $this->get_attribute($attr);

foreach ($infolist as $info) {
$output .= $info["Prefix"] . ($info["Factor"] * $value) . " " . $info["Title"] ."<br>";
}
return "<a href=\"text://<div align=left>".$output."</div>\">".$linktitle."</a>";
}

function get_attribute($attr)
{
$attributelist = array(
"Strength" => array(
array("Factor" => 3, "Prefix" => "+", "Title" => "Combat rating", "Description" => "Increases Combat rating when using melee weapons (except daggers)"),
array("Factor" => 2, "Prefix" => "+", "Title" => "Armor", "Description" => "Increases Armor"),
array("Factor" => 0.05, "Prefix" => "+", "Title" => "Natural Stamina regeneration", "Description" => "Increases Natural Stamina regeneration"),
array("Factor" => 0.15, "Prefix" => "+", "Title" => "OOC Stamina regeneration", "Description" => "Increases Out of Combat Stamina regeneration"),
array("Factor" => 2, "Prefix" => "+", "Title" => "Stamina", "Description" => "Increases Stamina"),
array("Factor" => 0.15, "Prefix" => "+", "Title" => "OOC Health regeneration", "Description" => "Increases Out of Combat Health regeneration")),
"Intelligence" => array(
array("Factor" => 0.6, "Prefix" => "+", "Title" => "Spell damage (mage)", "Description" => "Increases Spell damage for spells with Intelligence attribute (mage spells)"),
array("Factor" => 3, "Prefix" => "+", "Title" => "Mana", "Description" => "Increase Mana points"),
array("Factor" => 0.07, "Prefix" => "+", "Title" => "Natural Mana regeneration", "Description" => "Increases Natural Mana regeneration"),
array("Factor" => 0.5, "Prefix" => "+", "Title" => "Protection from Electrical/Fire/Cold", "Description" => "Increases protection from Electrical/Fire/Cold magic"),
array("Factor" => 0.38, "Prefix" => "+", "Title" => "OOC Mana regeneration", "Description" => "Increases Out of Combat Mana regeneration")),
"Constitution" => array(
array("Factor" => 8, "Prefix" => "+", "Title" => "Health (Soldier)", "Description" => "Increases Health points for Soldiers"),
array("Factor" => 6, "Prefix" => "+", "Title" => "Health (Ranger, HoX, Assassin)", "Description" => "Increases Health points for Ranger, HoX and Assassin"),
array("Factor" => 5, "Prefix" => "+", "Title" => "Health (Other classes)", "Description" => "Increases Health points for other classes"),
array("Factor" => 3, "Prefix" => "+", "Title" => "Stamina", "Description" => "Increase Stamina points"),
array("Factor" => 0.05, "Prefix" => "+", "Title" => "Natural Stamina regeneration", "Description" => "Increases Natural Stamina regeneration"),
array("Factor" => 0.15, "Prefix" => "+", "Title" => "OOC Stamina regeneration", "Description" => "Increase Out of Combat Stamina regeneration"),
array("Factor" => 0.15, "Prefix" => "+", "Title" => "OOC Health regeneration", "Description" => "Increases Out of Combat Health regeneration")),
"Dexterity" => array(
array("Factor" => 0.5, "Prefix" => "+", "Title" => "Evade rating", "Description" => "Increases Evade rating"),
array("Factor" => 2, "Prefix" => "+", "Title" => "Stamina", "Description" => "Increases Stamina points"),
array("Factor" => 3, "Prefix" => "+", "Title" => "Combat rating (ranged, daggers)", "Description" => "Increases Combat rating with ranged weapons and daggers"),
array("Factor" => 0.05, "Prefix" => "+", "Title" => "Natural Stamina regeneration", "Description" => "Increases Natural Stamina regeneration"),
array("Factor" => 0.15, "Prefix" => "+", "Title" => "OOC Stamina regeneration", "Description" => "Increases Out of Combat Stamina regeneration")),
"Wisdom" => array(
array("Factor" => 0.6, "Prefix" => "+", "Title" => "Spell damage (priest)", "Description" => "Increases Spell damage for spells with Wisdom attribute (priest spells)"),
array("Factor" => 3, "Prefix" => "+", "Title" => "Mana", "Description" => "Increases Mana points"),
array("Factor" => 0.07, "Prefix" => "+", "Title" => "Natural Mana regeneration", "Description" => "Increases Natural Mana regeneration"),
array("Factor" => 0.38, "Prefix" => "+", "Title" => "OOC Mana regeneration", "Description" => "Increase Out of Combat Mana regeneration"),
array("Factor" => 0.5, "Prefix" => "+", "Title" => "Protection (Holy/Unholy)", "Description" => "Increases Protection from Holy/Unholy magic"))
 ); 

return $attributelist[$attr];
}
}
?>
--- End code ---

Poonjab:
Very nice.  I'll be checkin this out when I get a chance.

DJKRose:
Looks good! I'm gonna test it soon...

Poonjab:
This module is working great and is already very popular in my guild.  Thanks again.

heljeere:
Happy to hear that. :)

Let me know if you find any mistakes/miscalculations. I do hope Funcom will update the online reference list if they change the values.

Navigation

[0] Message Index

[#] Next page

Go to full version