vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Dice Roller Hack [BBCode] (https://vborg.vbsupport.ru/showthread.php?t=113972)

Eq4bits 06-23-2007 09:05 PM

If you have access to your MySQL you can go in and add the 'dice' field to the 'thread' table with the properties of MediumText and Not Null

Blackhat 06-23-2007 10:44 PM

What about fixing the plug-in instead ?

Blackhat 06-24-2007 03:36 PM

Ok,


Im using the RPG dice roll, but when I choose a dice and replies I just get this

Quote:

[dice0]

cclaerhout 06-26-2007 03:27 PM

Well, i've tested my RPG hack on the newest vB version and it works... Try to do it on a new thread.

NolF 08-27-2007 08:29 AM

Awsome hack :O too bad it doesn't work on 3.6.x
I was wondering if anyone could bother to port this to 3.6 :( I had a look at the xml and lits not too long, I would say that the problem is with the instalation code but I don't know.

It would be greatly appreciated if someone could ^^ thx

Eq4bits 08-27-2007 01:40 PM

I installed this way back (not the fancy icon clicking one but the write the bbcode one) several upgrades ago. Running 3.6.7PL right now and having no problem with it. Which one are you trying to use? there are several different versions within this thread.

R1chardYoung 09-03-2007 07:53 AM

Im running 3.6.7 and have no issues - good hack.

vooood 06-02-2008 08:07 AM

I have installed this on vBulletin 3.7.1 and it works perfectly. I used the latest updated version and not the one with buttons and images. How about posting this in the 3.7 Mods forum?

Eq4bits 03-24-2009 03:08 AM

I have had this installed on my 3.8.1PL1 vB now and it still works perfectly (the one without the buttons, but there ARE dice images)

Najoh 09-08-2009 03:28 PM

I have modified the xml and its working on the last version 3.8.4 :

Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="dice" active="1">
        <title>Dice Roller</title>
        <description>Rolls dice in postbit</description>
        <version>1.0</version>
        <codes>
                <code version="1.0">
                        <installcode><![CDATA[$vbulletin->db->query_write("ALTER TABLE `vbulletin_thread` ADD `dice` MEDIUMTEXT NOT NULL");
$vbulletin->db->query_write("ALTER TABLE `vbulletin_post` ADD `dice` mediumtext not null");]]></installcode>
                        <uninstallcode><![CDATA[$vbulletin->db->query_write("ALTER TABLE `thread` DROP COLUMN `dice`");
$vbulletin->db->query_write("ALTER TABLE `vbulletin_post` DROP COLUMN `dice` ");]]></uninstallcode>
                </code>
        </codes>
        <templates>
                <template name="dice" templatetype="template" date="1145915902" username="admin" version="3.5.4"><![CDATA[<img src="images/dice/$point.gif" width="63" height="62" />]]></template>
                <template name="postbit_dice" templatetype="template" date="1145915990" username="admin" version="3.5.4"><![CDATA[<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
  <td><smallfont><b>Dice roll with $dicesno dices of $dicesfaces faces: $dicepoints points</b></smallfont></td>
</tr>
<tr>
  <td style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; BACKGROUND-COLOR: #D7D7D7;">
$dicedata
</td>
</tr>
</table><br/>]]></template>
        </templates>
        <plugins>
                <plugin active="1">
                        <title>dice_process_data</title>
                        <hookname>newpost_process</hookname>
                        <phpcode><![CDATA[// Hack
                if (@eregi("\[dice",$post['message']))
                {
                        $diceresult = array();
                        preg_match_all("/\[dice=([1-5])\]([0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult);
                       
                        $dices = $diceresult[1];
                        $faces = $diceresult[2];

                        $dicedetail = array();
                        $rollcount = count($dices);
                       
                        $validdice = 0;
                        for ($i = 0; $i < $rollcount; $i++)
                        {
                                if ($faces[$i] >= 2 && $faces[$i] <= 30)
                                {
                                        $diceresult[0][$i] = str_replace("[","\[",$diceresult[0][$i]);
                                        $diceresult[0][$i] = str_replace("]","\]",$diceresult[0][$i]);
                                        $diceresult[0][$i] = str_replace("/","\/",$diceresult[0][$i]);                                               
                                        $post['message'] = preg_replace("/".$diceresult[0][$i]."/","[dice".($validdice)."]",$post['message'],1);
                               
                                        $dicedetail[$validdice]['dices'] = $dices[$i];
                                        $dicedetail[$validdice]['faces'] = $faces[$i];
                                        $dicedetail[$validdice]['data'] = array();
                                        for ($j = 0; $j < $dices[$i]; $j++)
                                        {
                                                $dicedetail[$validdice]['data'][] = rand(1,$faces[$i]);       
                                        }
                                        $validdice++;
                                }
                        }
                       
                        if (!empty($dicedetail))
                        {
                                  $dataman->set('dice',serialize($dicedetail));
                        }
                }
                // End Hack]]></phpcode>
                </plugin>
                <plugin active="1">
                        <title>dice_postbit_convert</title>
                        <hookname>postbit_display_complete</hookname>
                        <phpcode><![CDATA[// Hack: dice
        if ($post['dice'])
        {
                $dicearray = unserialize($post['dice']);
                $totalroll = count($dicearray);
               
                for ($i = 0; $i < $totalroll; $i++)
                {
                        $dicedata = "";               
                        $dicepoints = 0;
                        $dicesno = $dicearray[$i]['dices'];
                        $dicesfaces = $dicearray[$i]['faces'];
                       
                        foreach ($dicearray[$i]['data'] as $point)
                        {
                                eval('$dicedata .= "' . fetch_template("dice") . '";');
                                $dicepoints += $point;                 
                        }
                        eval('$dice = "' . fetch_template("postbit_dice") . '";');

                        $post['message'] = preg_replace("/\[dice$i\]/i","$dice",$post['message']);
                }
        }]]></phpcode>
                </plugin>
                <plugin active="1">
                        <title>dice_set_valid_fields</title>
                        <hookname>postdata_start</hookname>
                        <phpcode><![CDATA[$this->validfields['dice'] = array(TYPE_STR, REQ_NO);]]></phpcode>
                </plugin>
                <plugin active="1">
                        <title>dice_set_valid_fields_new_thread</title>
                        <hookname>threadfpdata_start</hookname>
                        <phpcode><![CDATA[$this->validfields['dice'] = array(TYPE_STR, REQ_NO);]]></phpcode>
                </plugin>
        </plugins>
        <phrases>
        </phrases>
        <options>
        </options>
</product>



All times are GMT. The time now is 03:40 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.01595 seconds
  • Memory Usage 1,773KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)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