collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Tools Module  (Read 5445 times)

0 Members and 2 Guests are viewing this topic.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Tools Module
« on: January 15, 2008, 06:21:08 am »
This module Contains Usefull Functions to be used in Other Modules,
i have Moved a Bunch from Bot.php
also Added an Improved version of chatcmd function

If any 1 has any Ideas on Other Usefull Functions that should be Added let me know

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Tools Module
« Reply #1 on: January 17, 2008, 08:53:20 pm »

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Tools Module
« Reply #2 on: January 18, 2008, 12:29:13 am »
Here's one...
Code: [Select]
    /*
        I stole this from Helpbot, and modified it to take a targetlevel
        and a requestor level instead of a percentage.
        I also modified the return value to be just a HTML color code (#XXXXXX)
        Thanks Beaker for this handy function! http://www.kuren.org/ao/helpbot/

        This function returns the color code of the color the hp bar that a
        player of requestorlevel would see for a player of targetlevel.
        ie:
        if requestorlevel is 220 and targetlevel is 5, a grey color code would be returned.
        if requestorlevel is 220 and targetlevel is 200, a greenish color code would be returned.
        if requesterlevel is 200 and targetlevel is 220, a orangish/redish color code would be returned.
        if requestorlevel and targetlevel are equal, a yello color code is returned.
    */
    function con2rgb($targetlevel, $requestorlevel)
    { // Start function con2rgb()
        $percent = $targetlevel/$requestorlevel*100.000001;
        $G = 214.0001-(($percent-100.0001)/100.0001)*4.0001*214.0001;
        if ($G<0)
            $G=0;
        elseif ($G>214)
            $G="D6";
        else
        {
            if ($G<16)
                $G=sprintf("0%X",$G);
            else
                $G=sprintf("%X",$G);
        }

        $R = 214.00001-(100.0001-$percent)*4.0001/100.0001*214.0001;
        if ($R<0)
            $R=0;
        elseif ($R>214)
            $R="D6";
        else
        {
            if ($R<16)
                $R=sprintf("0%X",$R);
            else
                $R=sprintf("%X",$R);
        }
        if ($percent<75.0001)
            return "#909090";
        if ($percent>124.9999)
            return "#D60000";

        return "#".$R.$G."00";
    } // End function con2rgb()

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 441
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal