BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.4.x Custom/Unofficial Modules => Topic started by: Hyde on August 25, 2007, 09:27:39 pm

Title: Modified TowerAttack.php
Post by: Hyde on August 25, 2007, 09:27:39 pm
Modification to add faction colors to the display. Hopefully this can get slurped into the SVN so here's a diff to patch this against 0.4.1's TowerAttack (download original version to patch (http://svn.shadow-realm.org/index.py/BeBot/tags/0.4.1/modules/TowerAttack.php?revision=912)) ...

`diff _TowerAttack.php-revision912 TowerAttack.php`

Code: [Select]
146a147,151
>       /* Called to colorize faction string */
>         function factioncolor($side) {
>                 $side = "##" . strtolower($side) . "##" . $side . "##end##";
>                 return($side);
>         }
159,160c164,165
<                       $battle .= "Winner: <font color=CCCCTextColor>" . stripslashes($res[1]) . "</font> <font color=CCCCHeaderColor>(" . $res[2] . ")</font>\n";
<                       $battle .= "Looser: <font color=CCCCTextColor>" . stripslashes($res[3]) . "</font>  <font color=CCCCHeaderColor>(" . $res[4] . ")</font>\n";
---
>                       $battle .= "Winner: <font color=CCCCTextColor>" . stripslashes($res[1]) . "</font> <font color=CCCCHeaderColor>(" . $this -> factioncolor($res[2]) . ")</font>\n";
>                       $battle .= "Looser: <font color=CCCCTextColor>" . stripslashes($res[3]) . "</font>  <font color=CCCCHeaderColor>(" . $this -> factioncolor($res[4]) . ")</font>\n";
183,184c188,189
<                       $battle .= "Attacking Guild: <font color=CCCCTextColor>" . stripslashes($res[1]) . "</font>  <font color=CCCCHeaderColor>(" . $res[2] . ")</font>\n";
<                       $battle .= "Defending Guild: <font color=CCCCTextColor>" . stripslashes($res[6]) . "</font>  <font color=CCCCHeaderColor>(" . $res[7] . ")</font>\n";
---
>                       $battle .= "Attacking Guild: <font color=CCCCTextColor>" . stripslashes($res[1]) . "</font>  <font color=CCCCHeaderColor>(" . $this -> factioncolor($res[2]) . ")</font>\n";
>                       $battle .= "Defending Guild: <font color=CCCCTextColor>" . stripslashes($res[6]) . "</font>  <font color=CCCCHeaderColor>(" . $this -> factioncolor($res[7]) . ")</font>\n";
244,245c249,250
<                       $msg = "<font color=#ffff00>" . $off_guild . "</font> <font color=#dddddd>(" . $off_side . ")</font> has attacked <font color=#ffff00>" .
<                       $def_guild . "</font> <font color=#dddddd>(" . $def_side . ")</font> in " . $zone . " at " . $x_coords . "x" . $y_coords. ". Attacker: <font color=#ffff00>" .
---
>                       $msg = "<font color=#ffff00>" . $off_guild . "</font> <font color=#dddddd>(</font>" . $this -> factioncolor($off_side) . "<font color=#dddddd>)</font> has attacked <font color=#ffff00>" .
>                       $def_guild . "</font> <font color=#dddddd>(</font>" . $this -> factioncolor($def_side) . "<font color=#dddddd>)</font> in " . $zone . " at " . $x_coords . "x" . $y_coords. ". Attacker: <font color=#ffff00>" .
249c254
<                       $def_guild . "</font> <font color=#dddddd>(" . $def_side . ")</font> in " . $zone . " at " . $x_coords . "x" . $y_coords. ".";
---
>                       $def_guild . "</font> <font color=#dddddd>(</font>" . $this -> factioncolor($def_side) . "<font color=#dddddd>)</font> in " . $zone . " at " . $x_coords . "x" . $y_coords. ".";
Title: Re: Modified TowerAttack.php
Post by: Blueeagle on August 26, 2007, 02:39:01 am
The "new and improved"(tm) way of doing this is ##clan##organisationname##end##

For further reference read http://bebot.link/wiki/colors
Title: Re: Modified TowerAttack.php
Post by: Hyde on August 27, 2007, 07:02:03 am
The "new and improved"(tm) way of doing this is ##clan##organisationname##end##

For further reference read http://bebot.link/wiki/colors

Actually, if you look at what I did, that's exactly what I did. I just called a function to lowercase the side name.

I think the confusion lies in where I said "called to colorize", bad terminology mishmash :)
Title: Re: Modified TowerAttack.php
Post by: Blueeagle on August 27, 2007, 07:54:56 am
My bad. I was looking at the old code. :)
Title: Re: Modified TowerAttack.php
Post by: Dabaron on September 12, 2007, 07:17:50 am
Maybe I'm just being dumb here... but what did you use to extract (and now to put it into the file)?

I assumed you used diff to extract it and would need patch to insert it into the file with what you pasted but when I attempt that I get:

(Stripping trailing CRs from patch.)
Hunk #2 FAILED at 164.
Hunk #3 FAILED at 188.
Hunk #4 FAILED at 249.
patch unexpectedly ends in middle of line
patch: **** unexpected end of file in patch at line 27


Any help would be appreciated
Title: Re: Modified TowerAttack.php
Post by: Slacklin on September 12, 2007, 07:52:28 am
If any of you had difficulties getting the code to insert properly, here is a fully edited version for you to download. Just extract and copy over the old file. (Be sure to backup the original just in case)

http://www.tainteddonuts.com/aogoodies/TowerAttack.zip (http://www.tainteddonuts.com/aogoodies/TowerAttack.zip)

Enjoy!
Title: Re: Modified TowerAttack.php
Post by: Dabaron on September 12, 2007, 08:47:14 am
Ok, that worked but I guess I should have read what was being changed a bit closer because it didn't do what I thought it was going to.  This only changes the battle blob, not the attack messages themselves.  Guess I'll write it up for that part (so it looks like the one in the .2.x release I had) and post when I get around to doing it.
Title: Re: Modified TowerAttack.php
Post by: Nogoal on September 17, 2007, 05:17:26 pm
http://bebot.link/index.php/topic,963.0.html :P Also gives LCA numbers!
SimplePortal 2.3.7 © 2008-2024, SimplePortal