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

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

Author Topic: Modified TowerAttack.php  (Read 2779 times)

0 Members and 1 Guest are viewing this topic.

Offline Hyde

  • BeBot Apprentice
  • ***
  • Posts: 92
  • Karma: +0/-0
Modified TowerAttack.php
« 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) ...

`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. ".";
« Last Edit: August 25, 2007, 09:29:32 pm by Hyde »
Doctorhyde/Jexyll/Goraud@RK2

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: Modified TowerAttack.php
« Reply #1 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
The only problem that can't be solved by adding another wrapper is having too many wrappers.

Offline Hyde

  • BeBot Apprentice
  • ***
  • Posts: 92
  • Karma: +0/-0
Re: Modified TowerAttack.php
« Reply #2 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 :)
Doctorhyde/Jexyll/Goraud@RK2

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: Modified TowerAttack.php
« Reply #3 on: August 27, 2007, 07:54:56 am »
My bad. I was looking at the old code. :)
The only problem that can't be solved by adding another wrapper is having too many wrappers.

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Modified TowerAttack.php
« Reply #4 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

Offline Slacklin

  • BeBot User
  • **
  • Posts: 52
  • Karma: +0/-0
  • My spoon is too big!
    • United Org Site
Re: Modified TowerAttack.php
« Reply #5 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

Enjoy!
« Last Edit: September 12, 2007, 07:57:17 am by jakethegamer »

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Modified TowerAttack.php
« Reply #6 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.

Offline Nogoal

  • BeBot Apprentice
  • ***
  • Posts: 77
  • Karma: +0/-0
Re: Modified TowerAttack.php
« Reply #7 on: September 17, 2007, 05:17:26 pm »

 

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


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


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


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 679
  • 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