vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Major Additions - Chess (https://vborg.vbsupport.ru/showthread.php?t=153638)

Deepdog009 08-12-2007 02:16 PM

Carnage if its not asking 2 much, please think about a ranking system 2 show who's the Grandmasters, masters and lower rankings by usergroup...

Keep the ball rolling and U gotts my vote:up:

rungok 08-12-2007 08:46 PM

Quote:

Originally Posted by Carnage- (Post 1313034)
Do you get it with ajax turned off? what browser are you viewing it it? do you have any other mods that add javascript to your pages?

@everyone else:
i'm planning a new release asap however have been busy this week moving my forums to a new server (and managing to loose 2 months worth of posts while doing it...) so its behind the schedual i had wanted for it.

Yes, I'm getting the same with Ajax turned off. Yes, I have several mods that have their own javascript at the top. Browser is IE.

aranthorn 08-13-2007 03:04 AM

Excellent. Installed :)

Carnage 08-13-2007 07:31 PM

i've been playing arround and have managed to replicate the reset board bug; working on a solution.

For now, i'm going to release a minor update with a few misc bug fixes

dethfire 08-13-2007 08:25 PM

If I post a move using click method, I see the change, but when I click post reply, the move is erased visually, but shows up in the text area. Also as a spectator, it will put coordinate moves in my quick reply.

also can posts be appended into the same post? Some games have 10s of pages of posts.

Carnage 08-13-2007 09:18 PM

Quote:

If I post a move using click method, I see the change, but when I click post reply, the move is erased visually, but shows up in the text area. Also as a spectator, it will put coordinate moves in my quick reply.
The board is reset while the move is sent to the server, once the move has been saved into the db it should come up in the chatbox and be remade on the board via ajax.

Quote:

also can posts be appended into the same post? Some games have 10s of pages of posts.
its a good idea to turn off post count in the forum you use for the chess mod.

dethfire 08-14-2007 03:15 PM

any way to exclude chess games from "new posts" functions? Also when another user enters a game by moving a piece it doesn't update the forum view thread title. It changes the thread title in the thread, but if you goto the forum view the thread title is still for example "Dethfire vs "

btw, can you include version checking in the product page?

aranthorn 08-18-2007 04:37 PM

I have a couple really nit-picky users complained about white/black, flipped board, etc. Because this mod uses style CSS definitions of alt1 and alt2 for the board (which I think was the right way to go in coding it, btw) some users of mine complained that the Queen's not on her color. She is, but my some of styles are defined with light and dark tones reversed from vB's default. So here's what I did:

I added this bit into every style's "Additional CSS Definitions" area in style manger
Code:

/** START Chess Board **/
                .chess1 {
                  background-color : #FFFFFF;
                }
               
                .chess2 {
                  background-color : #000000;
                }
/** END Chess Board **/

The I changed the plugin "showthread_complete" for the product "chess" to this:
Code:

if($forumid == $vbulletin->options['chess_forumid'])
{
$empty = array('a'=>'','b'=>'','c'=>'','d'=>'','e'=>'','f'=>'','g'=>'','h'=>'');
$board = array(1=>array('a'=>'wR','b'=>'wN','c'=>'wB','d'=>'wQ','e'=>'wK',f=>'wB','g'=>'wN','h'=>'wR'),
              2=>array('a'=>'wP','b'=>'wP','c'=>'wP','d'=>'wP','e'=>'wP','f'=>'wP','g'=>'wP','h'=>'wP'),
              3=>$empty,
              4=>$empty,
              5=>$empty,
              6=>$empty,
              7=>array('a'=>'bP','b'=>'bP','c'=>'bP','d'=>'bP','e'=>'bP','f'=>'bP','g'=>'bP',h=>'bP'),
              8=>array('a'=>'bR','b'=>'bN','c'=>'bB','d'=>'bQ','e'=>'bK','f'=>'bB','g'=>'bN','h'=>'bR'));

if(preg_match_all("#player\(1,([^)]+)\)#",$data[0][1],$matches,PREG_SET_ORDER))
{
        $player1 = $matches[0][1];
}
else
{
        $player1 = $data[0][0];
}
if(preg_match_all("#player\(2,([^)]+)\)#",$data[0][1],$matches,PREG_SET_ORDER))
{
        $player2 = $matches[0][1];
}

$moveno = 1;
$taken = array();
foreach($data AS $move)
{
        if(!$player2)
        {
                if($move[0] != $player1)
                {
                        $player2 = $move[0];
                }
        }
        $postcnt++;
       
        if( (($moveno % 2) && $move[0] == $player1) || (!($moveno % 2) && $move[0] == $player2))
        {         
                if(preg_match_all("#\(([a-h])([1-8]),([a-h])([1-8])\)#",$move[1],$matches,PREG_SET_ORDER))
                {
                        $moveno++;
                }
                foreach($matches AS $match)
                {
                        if($board[$match[4]][$match[3]] != '')
                        {
                                $taken[] = $board[$match[4]][$match[3]];
                        }
                        $board[$match[4]][$match[3]] = $board[$match[2]][$match[1]];
                        $board[$match[2]][$match[1]] = '';
                }
                preg_match_all("#\(([a-h])([1-8]),(w|b)(Q|R|N|B|K|P)\)#",$move[1],$matches,PREG_SET_ORDER);
                foreach($matches AS $match)
                {
                        $board[$match[2]][$match[1]] = $match[3].$match[4];
                }
        }

        $movestext[] =  implode($move,": ");

}

$post['signature'] =  "<div id=\"chesschat\" style=\"max-height:200px;overflow:auto;\">" . implode(array_reverse($movestext),"<br />") . "</div>";
if($vbulletin->userinfo['userid'] == 100000000)
{
print_r($vbulletin->options);
die($vbulletin->options['chess_rotation']);
}
if($vbulletin->options['chess_rotation'])
{
        $board = array_reverse($board,true);
}
foreach($board AS $row =>$rowdata)
{
        $output .= "<tr height=\"40px\"><td>$row</td>";
        foreach($rowdata AS $col => $coldata)
        {
                $class = ($class == 'chess1') ? 'chess2':'chess1';
                $imgstr = (($coldata == '') ? ('&nbsp;') : ('<img width="40px" height="40px" src="' . $vbulletin->options['bburl'] . '/images/chess/' . (($coldata[0] == 'b') ? ($vbulletin->options['chess_black']) : ($vbulletin->options['chess_white'])) . "/" . $coldata[1] . ".gif\" />"));
                $output .= "<td id=\"".$col.$row."\"width=\"40px\" onclick=\"move(event,'".$col.$row."')\" class=\"$class\">$imgstr</td>";
        }
        $output .= "</tr>";
        $class = ($class == 'chess1') ? 'chess2':'chess1';

}

foreach($taken AS $piece)
{
        if(substr($piece,0,1) == "w")
        {
                if(!$white)
                {
                        $white = "<tr>";
                        $whitecnt = 0;
                }
               
                $white .= "<td><img src=\"".$vbulletin->options['bburl']."/images/chess/".$vbulletin->options['chess_white']."/".$piece[1].".gif\" /></td>";
                $whitecnt ++;
               
                if(!($whitecnt % 6))
                {
                        $white .= "</tr><tr>";
                }
        }
        else
        {
                if(!$black)
                {
                        $black = "<tr>";
                        $blackcnt = 0;
                }

                $black .= "<td><img src=\"".$vbulletin->options['bburl']."/images/chess/".$vbulletin->options['chess_black']."/".$piece[1].".gif\" /></td>";
                $blackcnt ++;
               
                if(!($blackcnt % 6))
                {
                        $black .= "</tr><tr>";
                }
        }
}

$game_text = $player1 . " vs " . $player2;
$moveplr = (($moveno % 2) ? $player1 : $player2);
$move_text = "Move: $moveno <br /> " . $moveplr . " to move next.";

eval('$postbits = "' . fetch_template('chess') . '";');
}

All I did was replace the alt1 and alt2 references in the original product plugin with chess1 and chess2 which was defined with white and black backgrounds in the "Additional CSS Definitions" that I added. The part that has the tweaks is in bold / red.

I am going to start looking into making a marble chessboard, wood chessboard, etc.

dethfire 08-18-2007 04:50 PM

Quote:

Originally Posted by aranthorn (Post 1320389)
I am going to start looking into making a marble chessboard, wood chessboard, etc.

Awesome! Thanks, I also had some users who noted the non standard board setup.

aranthorn 08-18-2007 05:06 PM

Actually, using images there is pretty simple if you know anything about CSS ;)

I've done a marble one already:
* Create a directory called "board" in your /images/chess/ directory.
* Upload the attached files to that directory
* Change that CSS definition to:
Code:

/** START Chess Board **/
                .chess1 {
                  background : url(http://www.pathtoyourforum.com/images/chess/board/white.jpg);
                }
               
                .chess2 {
                  background : url(http://www.pathtoyourforum.com/images/chess/board/black.jpg);
                }
/** END Chess Board **/

Make sure you change that code for your forum's information. For example, my vbulletin is intalled under /forum, so my path is:
http://www.mydomain.com/forum/images/chess/board/white.jpg


All times are GMT. The time now is 04:31 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01719 seconds
  • Memory Usage 1,772KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete