[h] Roll Dice

[h] Roll Dice RC2

No permission to download

Hoffi

Well-known member
Hoffi submitted a new resource:

[h] Roll Dice - Roll Dice in your Posts and see the results with win/loss

This Dice Manager from Hoffi is an awesome Tool, which is used to roll Dice.

In the AdminCP the Admin can add and edit dice, rules and wiresets (RPG Systems like D&D) with easy and complex rules. All can be ex- and imported.

You can do much more, than roll a simmple d10 inside a post. You can roll your attack roll with your skill and the system will tell you, it your roll was a success.

Inside your post the rolls are displayed and can be collapsed to save space.

I developed this addon...

Read more about this resource...
 
@Hoffi what licence is this under?

Additionally, you should disclose that this addon phones-home if you upgrade the addon (or reinstall). Especially as it fetches and pushes data to your server.

Otherwise this addon looks quite good and comprehensive.
 
@Hoffi

After checking, there are a few serious short coming of this addon:
  • Any errors on install are logged to a file and silently ignored, you should use XenForo_Error::logException() where required.
  • Does not use listener hints.
  • There is no check for if the user is logged in on the Hoffi_DM_ControllerPublic_Dice
    • actionRollNow doesn't check if they are allowed to roll.
    • actionDeleteNow doesn't check permissions. Any user can soft-delete every roll on a forum.
    • Should use XenForo_ControllerHelper_ForumThreadPost, as it has standard forum/thread/post is viewable and exists functionality
  • can_see_dice_post & can_delete_diceroll_post permissions don't go through an overridable method and use XenForo_Permission::hasContentPermission() like can_roll_dice_post does.
  • Random 'h_dice_rolls' column added to the xf_thread table without anything using or updating it. This will cause datawriters to fail when fed the contents of xf_thread.* from a select statement.
  • Why are you using the collation 'latin1_swedish_ci' (when the table is marked utf8_general_ci) ?
  • The xf_hoffi_dm_rolls table needs indexes on the following set of columns sets:
    • post_id
    • user_id
    • thread_id, roll_time
    • hash, roll_time
    • roll_state, roll_time
  • The xf_hoffi_dm_rules & xf_hoffi_dm_dice both should have a unique index on the title IMO.
XML changes:
Code:
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenController" active="1" hint="XenForo_ControllerPublic_Help" description="XenForo_ControllerPublic_Help"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenController" active="1" hint="XenForo_ControllerAdmin_Forum" description="XenForo_ControllerAdmin_Forum"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenController" active="1" hint="XenForo_ControllerAdmin_Stats" description="XenForo_ControllerAdmin_Stats"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenController" active="1" hint="XenForo_ControllerPublic_InlineMod_Post" description="XenForo_ControllerPublic_InlineMod_Post"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenController" active="1" hint="XenForo_ControllerPublic_Thread" description="XenForo_ControllerPublic_Thread"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenController" active="1" hint="XenForo_ControllerPublic_Forum" description="XenForo_ControllerPublic_Forum"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenDataWriter" active="1" hint="XenForo_DataWriter_Forum" description="XenForo_DataWriter_Forum"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenDataWriter" active="1" hint="XenForo_DataWriter_Discussion_Thread" description="XenForo_DataWriter_Discussion_Thread"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenDataWriter" active="1" hint="XenForo_DataWriter_Discussion" description="XenForo_DataWriter_Discussion"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenDataWriter" active="1" hint="XenForo_DataWriter_DiscussionMessage_Post" description="XenForo_DataWriter_DiscussionMessage_Post"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenModel" active="1" hint="XenForo_Model_Forum" description="XenForo_Model_Forum"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenModel" active="1" hint="XenForo_Model_Thread" description="XenForo_Model_Thread"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenModel" active="1" hint="XenForo_Model_User" description="XenForo_Model_User"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenModel" active="1" hint="XenForo_Model_Post" description="XenForo_Model_Post"/>
    <listener event_id="load_class" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="listenModel" active="1" hint="XenForo_Model_Stats" description="XenForo_Model_Stats"/>
    <listener event_id="template_create" execute_order="10" callback_class="Hoffi_DM_EventListener_Dice" callback_method="templateCreate" active="1" hint="application_splash" description="adds parameter for Icon"/>

SQL:
Code:
CREATE TABLE `xf_hoffi_dm_rolls` (
  `roll_id` int(10) NOT NULL AUTO_INCREMENT,
  `hash` varchar(35) DEFAULT NULL,
  `post_id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  `thread_id` int(10) NOT NULL,
  `comment` varchar(200) DEFAULT NULL,
  `data` text NOT NULL,
  `wins` int(1) DEFAULT NULL,
  `result_sum` int(10) DEFAULT NULL,
  `wireset` varchar(50) DEFAULT NULL,
  `roll_state` enum('visible','moderated','deleted') NOT NULL DEFAULT 'visible',
  `roll_time` int(10) NOT NULL,
  `options` text,
  PRIMARY KEY (`roll_id`),
  KEY `post_id` (`post_id`),
  KEY `user_id` (`user_id`),
  KEY `hash` (`hash`,`roll_time`),
  KEY `thread_id` (`thread_id`,`roll_time`),
  KEY `roll_time` (`roll_state`,`roll_time`),
INDEX `FK_xf_hoffi_dm_rolls_xf_hoffi_dm_wireset` (`wireset`),
CONSTRAINT `FK_xf_hoffi_dm_rolls_xf_hoffi_dm_wireset` FOREIGN KEY (`wireset`) REFERENCES `xf_hoffi_dm_wireset` (`tag`) ON UPDATE NO ACTION ON DELETE SET NULL
) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
 
Last edited:
Additionally, you should disclose that this addon phones-home if you upgrade the addon (or reinstall). Especially as it fetches and pushes data to your server.
It's described in the readme. And it only connect to my server, if you alowwed it before. But you're right, I will describe it more detailed.

For the rest of your feedback, I will take a detailed lokk tomorrow.
 
  • Like
Reactions: Xon
It's described in the readme. And it only connect to my server, if you alowwed it before. But you're right, I will describe it more detailed.
The resource guidelines where updated to require addon writers to be explicit about that sort of thing after someone abused it.

For the rest of your feedback, I will take a detailed lokk tomorrow.
Cheers.
 
Where is the import folder? I don't see where to import anything to get started.

Also, I try to add dice to forum or start a new forum with dice and all I get is an error? Is this because I haven't imported anything yet?
 
Thanks, still somewhat new to Xenforo after using Vbulletin for many years.

BTW, is there a separate program called [h] Social Dice? I ask because it says the following:

"It seems, that you have installed the Social Groups by Waindigo.
You can install the [h] Social Dice, to roll Dice in the Social Forums."

Also, still getting the same error when trying to add the dice to a forum:

Unknown content type 'tinhte_xentag_forum'
 
Last edited:
Hi Hoffi:

Having some trouble getting this to appear in my forum...

Dropped folders in upload into their corresponding folders (js/library/styles)
Ran product-hRollDice.xml

Not sure where to drop the en and de folders, didn't install them.

We're seeing the options in our admin, and selected permissions to allow rolling dice in Quick Reply, Posts, and New Threads.

Nothing is showing on the forum. Also, we can't get a key, could you assist?
 
Maybe the images weren't upload correctly or the path isn't correct in the settings.

Edit a die and if there is no preiew on the left, the image can't be found.

edit-die-png.114853
 
Ahh ok if we get English, and the di looks somewhat legit, then this will be a nice surprise for guildies. We are in several D&D online games, so we roll on stuff all the time!! ;)
 
Hello, I'm on XenForo 1.5.11 and I can't find the settings for the addon. I didn't do anything with the files in /en/ because I don't know where to upload them.

Edit: I managed to find the settings, after using the admin set at installation but when I try to roll it says that I have no permissions
 
Last edited:
Top Bottom