• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Cast System TFS 1.1 (prototype)

Yamaken

Pro OpenTibia Developer
Joined
Jul 27, 2013
Messages
534
Solutions
4
Reaction score
430
Now i'm here to show you a cast system i'm developing. Right now its a prototype and i do not recommend to use it in production. Its better than most of free casts because almost all of them are a adaption of the Elf Cast System and these adaptions were not made by programmers. It has a better code structure( i believe) and is easier to understand. I'm accepting code contributions :)

Code(github): https://github.com/HeavenIsLost/cast

Just to mention: its a custom version made by me based on this cast without multithread overhead(which brings stability problems): https://github.com/otland/forgottenserver/pull/994

Commands:

Start casting:

!cast

With password:

!cast password

Stop/close the cast:

!stopcast

Commands(works inside the cast channel):

Show spectators list:

/spectators

Kick spectator:

/kick spectatorname

ban spectator:

/ban spectatorname

unban spectator:

/unban spectatorname

mute spectator:

/mute spectatorname

unmute spectator:

/unmute spectatorname

Change the password of the cast:

/password newpassword

Add this to the database:

SQL:
CREATE TABLE IF NOT EXISTS `live_casts` (
`player_id` int(11) NOT NULL,
`cast_name` varchar(255) NOT NULL,
`password` boolean NOT NULL DEFAULT false,
`description` varchar(255),
`spectators` smallint(5) DEFAULT 0,
UNIQUE KEY `player_id_2` (`player_id`),
FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB;

Its all :)
 
Looks good, thanks for sharing !
Thanks you all for the feedback :)

I will try to add commands to the spectator too, like changing the name and showing the spectators list.
Changing the name is a bit harder because i need to sanitize(check if the name contain bad characters, etc) the name and i don't know how to do that.
 
Thanks you all for the feedback :)

I will try to add commands to the spectator too, like changing the name and showing the spectators list.
Changing the name is a bit harder because i need to sanitize(check if the name contain bad characters, etc) the name and i don't know how to do that.

Database::escapeString (database.cpp)
 
That's not the proper way to do it. Database::escapeString() appends \ to escape characters. The easiest way to sanitize (assuming there is no function for that already) would be to iterate over the string and check if each character is withing a range i.e. if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') || (character >= '0' && character <= '9')). Or you can use regexps :D.
 
I have a little error with the cast I can not use it
if I can help or explain please look:

MSZkUSo.png

ilsdVXu.png

lxC0w8E.png
 
Are you creating the cast with password?
 
Back
Top