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: KOS Module w/ Guild KOS  (Read 26247 times)

0 Members and 1 Guest are viewing this topic.

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
KOS Module w/ Guild KOS
« on: July 11, 2008, 05:41:19 am »
"Borrowed" from Noers 4.x updated Kos module"

Commands
!kos     (Displays both the KOS guilds and Players.. Guilds on top.  In alpha order)
!kos padd <player> <reason>    (adds player to KOS list.  Note Reason is optional)
!kos gadd <guild> :<reason>    (adds guild to KOS list. Note : is needed between reason and name)
!kos pdel <player>    (deletes player from KOS list)
!kos gdel <guild>    (deletes guild from KOS list)

=============================================
Rev 1.   kos.php and gkos.php  w/ 2 seperate Databases
Rev 2.   kos.php and gkos.php combined.   New database created.
Rev 2a.   Fixed error in code.  :  is now required between guild name and reason.
Rev 2b.   Fixed !help command error.
When incorrect syntax used, bot said to use !help gkos for command list.  Should be  !help kos.
Included, modified Whois.php file to display if user is on kos list when doing a !whois lookup
Removed the drop table statements.  Should no longer be needed.
Rev 2c.  Updated whois.php file for R46-48 of bebot Hyborian.

Also, each command has it's own permissions.  See /tell BOTNAME !commands subs kos.


TO INSTALL
Without Whois Mod
Download  kos.phps  rename to kos.php  install to ./custom/modules/

With Whois Mod - Verified working with bebot version r24 through r26
Download  kos.phps  rename to kos.php  install to ./custom/modules/
Download  whois.phps  rename to whois.php  overwrite existing file in ./modules/

« Last Edit: July 15, 2008, 09:35:13 pm by kardsen »

Offline CheRny

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #1 on: July 12, 2008, 12:26:20 pm »
Well, I like kos module as you could add a guild as well, but comparing to blacklist is has some limitation as blacklist in integrated with whois and notes modules. For ex. if you do !whois and if there is a name in blacklist, whois function will show you warning: Warning! Blacklisted!, which is very good as well as you could see a reason for blacklisting. It'll be great if you could add similar function to your kos module. I know you will need to make some changes in other modules. For ex. in whois.php:

- 174:            $blname = $this -> bot -> db -> select("SELECT name FROM #___blacklist WHERE name = '". $name . "'");
+ 174:             $blname = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$name' AND type = 'playerkos'");

This way whois will show a warning is a player is in kos list.

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #2 on: July 12, 2008, 11:25:58 pm »
Cheny,

I'll look into this once I finish up fixing my supplies module.
Though I tend to shy away from messing with original coding.

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #3 on: July 14, 2008, 09:52:13 pm »
Cheny,

Had to change a couple things in whois.php

Should have your requested effect now.
please download new  kos.php and  whois.php and put in respective folders.

Offline CheRny

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #4 on: July 15, 2008, 07:41:09 am »
kardsen,

thanks a lot for it, for a few hours works great.

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #5 on: July 15, 2008, 09:34:34 pm »
updated the whois.php module.


Also,  included comments where I added code.. incase another mod needs to edit it.. you know where my changes are at :)

Look for
//// START KARDSEN MODIFICATION  PRT 1 FOR   KOSLIST  and WHOIS info display//////////////////


and

//// START KARDSEN MODIFICATION  PRT 2 FOR   KOSLIST  and WHOIS info display//////////////////

enjoy

Offline URFUBAR

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #6 on: July 15, 2008, 09:51:09 pm »
Hi there, followed the instructions (I'm using the svn version of the bot) and I although I can see the kos module listed when i do a "/tell botuser !modules" , none of the kos commands are available when I try and use them.

any ideas?

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #7 on: July 15, 2008, 09:55:05 pm »
are you the "owner" of the bot.  or a admin?

The bot has permission controls built into it


if you do a !whois on yourself
Look at the  Bot access:
it should read  Owner  or  Leader  or Admin

If you are lower than that.  All commands except adding a player to the KOS list will not work


Also,  can you give me a copy of the bot log when you try to use
!kos padd PLAYER REASON
or
!kos gadd GUILD : REASON  ?
and  just
!kos

Thanks

Offline URFUBAR

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #8 on: July 15, 2008, 10:07:01 pm »
Bot Access: Owner

Guild [TELL]    [INC]   Naho: !kos padd PLAYER REASON
Guild [TELL]    [OUT]   -> Naho: /tell Guild !help

same for the other commands


and kos.php is listed when you do a "/tell guild !modules" (under Custom).
« Last Edit: July 15, 2008, 10:18:44 pm by URFUBAR »

Offline URFUBAR

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #9 on: July 15, 2008, 10:21:38 pm »
Sorry, just looked at the module code and its all my fault... did a wget to get kos.phps and instead of receiving the file got the HTTP redirect page...

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #10 on: July 15, 2008, 10:33:46 pm »
1. shutdown bot
2. go into your  /conf/   folder
2a. delete file named   BOTNAME.Modules
3. go into your /custom/modules/   folder 
3a. delete old kos.php file and redownload my lastest one at the top of this post and install it to /custom/modules/
4. reload bot.
5. See if kos appears in the module list.
6. I believe the bot isn't picking up the kos module.   As my Kos module would not output /tell guild !help
it would output /tell guild Learn how to use the command. See !help kos



* Saw your post after typing above.
The  !modules list  is actually a Cache of the modules the bot has seen.  So it may be listing old modules you no longer have.

better command to use is  /tell BOT !commands kos all
to see if it list's it there..  or just do  /tell BOT !commands all

Offline CheRny

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #11 on: July 26, 2008, 02:34:45 pm »
There is a security problem in this module. Anyone could add/delete any player/guild to kos list and so on.

Seems like you should add something like:

Code: [Select]
function add_pkos($name, $player, $reason)
{
if ($this -> bot -> core("security") -> check_access($source, "LEADER"))
{
$player = strtolower($player);
$id = $this -> bot -> aoc -> get_uid($player);
if (empty($id))
{
return "Player " . ucfirst($player) . " does not exist.";
}
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$player' AND type = 'playerkos'");
if (!empty($result))
{
return ucfirst($player) . " is already on Kill on Sight.";
}
$reason = trim($reason);
$this -> bot -> db -> query("INSERT INTO koslist (player, addedby, reason, type) VALUES ('$player', '$name', '$reason', 'playerkos')");
$this -> load_pkos();
return ucfirst($player) . " was added to Kill on Sight.";
}
else
{
return "Your access level must be LEADER or higher to do this.";
}
}

In this case only LEADER and higher could add/del players in kos list. I attached a fixed version. Please, check as I dont spent to much time searching the code. Thanks a lot.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #12 on: July 26, 2008, 06:01:44 pm »
You could simply use the subcommand support for access control and use that for the checks. The module is creating entries for the padd/gadd and pdel/gdel subcommands, simply change those to ADMIN to have the same effect.

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #13 on: July 28, 2008, 02:37:44 pm »
I'm pretty sure that the commands had access controls built onto them, that is configurable in game.

I will look over the code once at work and verify.

Offline kardsen

  • BeBot Apprentice
  • ***
  • Posts: 81
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #14 on: July 28, 2008, 03:56:49 pm »
Confirmed.  My code is correct, and it does include command permissions


if you look at line 16 of my code, you will see that they have all been set to MEMBER.  You can change this ingame, or in the file... 

If you want to change it via the file, just change MEMBER to LEADER or OFFICER ADMIN   ect

      $this -> register_command("all", "kos", "MEMBER", array('padd' => 'MEMBER', 'gadd' => 'MEMBER', 'pdel' => 'MEMBER', 'gdel' => 'MEMBER'));


Or, you can do what I originally stated in my first post
Also, each command has it's own permissions.  See /tell BOTNAME !commands subs kos.

 

* 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: 462
  • 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