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: Identifying members who leave the guild ... a workable solution  (Read 4135 times)

0 Members and 1 Guest are viewing this topic.

Offline Riccarr

  • BeBot User
  • **
  • Posts: 35
  • Karma: +0/-0
Hello,

Seen numerous messages where people ask how/why doesn't the bot know when members leave the guild, and we've seen that the answer is basically because the bot does not get a message for member add/leave guild.

Several weeks ago when I added the ever popular YG command to our guild bot, it occurred to me that the YG information could be used to validate whether or not someone was still in our guild. Basically, when a person logs on, their guild name is retrieved from YG and compared to our guild name to see if they are the same.

There are a couple conditions to make sure that the comparison is not overly aggressive in identifying players as "left the guild". Mainly, I do not check unless their bot user record "added_at" is greater than "x" days old. This gives the new member time to have their profile scanned by YG and get their new guild tag (our guild) updated onto YG. You can play with an "x" days amount; I started with 2 but ended with a more conservative 5.

I also just chose to make a guild chat announcement for any online officers to see and investigate so they can determine if the "!member del" command should be used rather than coding a call to actively delete member. It's not 100% proof that the member does not belong; sometimes they take awhile to get updated in YG.

To use this technique you will need to have contacted YG to get your own account and password. Ask nicely to have access for your AoC guild usage.

Below is the code snippet I wrote; this should go into the LOGON.PHP file which is found in your MODULES folder. Sorry you will have to work it into your own module, I've made other alterations to my logon module and cannot upload the whole thing.

I located this snippet in the buddy($name, $msg) function. There may be better spot, but this works for me. Put the code at the end of the logon block, right after these two lines, they should be near line 212.

(do not add these lines, they are for reference)
$this -> show_logon("##logon_logon_spam##" . $res . "##end##");
$this -> last_log["on"][$name] = time();


After the above two lines, this is where I coded my catch for non-guilded members.
Code: [Select]
//check for players guild name; if not our guild name, then give them 2 days to get it into YG;
//if still not equal to our guild name then report it to guild chat for an officer to investigate
$playerGuildName = $this -> getPlayerGuildName($name);
$ourGuildName = $this -> bot -> core("settings") -> get("Relay", "Gcname");
if (($playerGuildName) && (strcasecmp($playerGuildName, $ourGuildName) <> 0))
{                   
    $results = $this -> bot -> db -> select("SELECT unix_timestamp() - added_at as account_age FROM #___users where nickname = '$name' and last_seen > 0");
    if (!empty($results))
    {
        $account_age = $results[0][0];
        //seconds in days = ((24 * 60) * 60) * (# of days)
        if ($account_age > (((24 * 60) * 60) * 5))  //last number represents "days", 5 in this case
        {
            $this -> bot -> send_gc("Player $name does not belong to this guild. Officer investigate to see if toon needs to be !member deleted");
        }
    }
}


This is also a supporting function you need to add into your module. I wrote this to call YG and return the guild name of the player. Its basically hacked from the YG module.

Code: [Select]
function getPlayerGuildName($name)
{

    $password = 'your password here';
    $servername = $this->bot->dimension;
    $yg_link = "http://aoc.yg.com/profilexml?n=$name&srv=$servername&pwd=$password";

    $ch = $this -> bot -> core("tools") -> get_site($yg_link, 1);
    if (empty($ch["content"]))
        return 0;

    $xmlprf = $ch["content"];
    $xmlobj = simplexml_load_string($xmlprf);

    /*  Done loading xml profile data */

    if($xmlobj->aocygplayerprofile->name)
        if($xmlobj->aocygplayerprofile->guild)
            return $xmlobj->aocygplayerprofile->guild;

    return 0;

}



I hope this helps as a workable solution for those growing/changing guilds with transient members.
Cheers,
Eric



Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Identifying members who leave the guild ... a workable solution
« Reply #1 on: May 08, 2010, 11:53:06 am »
Very nice and informative post Riccarr :)

Getrix is looking into integrating YG in several locations of the official distribution, allowing for better overall AoC functionality, but no ETA or promises on when/if it happens.
BeBot Founder and Fixer Kingpin

Offline BoA-Gert

  • BeBot User
  • **
  • Posts: 45
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #2 on: May 08, 2010, 03:31:10 pm »
Nice post - using this with a little tweak :)

In getPlayerGuildName I'm using:

Code: [Select]
if($xmlobj->aocygplayerprofile->name)
if($xmlobj->aocygplayerprofile->guild)
{
return $xmlobj->aocygplayerprofile->guild;
}
else
{
return "Not in a Guild";
}

return "Not found on YG";

and for the message that gets displayed I'm using:

Code: [Select]
$this -> bot -> send_gc("*** Player $name is logged as being in Guild:  ##logon_organization##$playerGuildName##end## on YG.COM - an Officer needs to check to see if this char needs to have !member del performed on it. ***");
This makes it a bit clearer as to what guild YG has them in or if it hasn't got them logged


Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #3 on: May 09, 2010, 02:55:52 am »
I only added this block to state what guild they are in to their login message.  Added at line 205.
Code: [Select]
$result = $this -> getPlayerGuildName($name);
if (!empty($result))
{
  $res .= "  ::  ##logon_organization##$result##end##";
}

And the function posted above.  Thanks for the post on this.  Very useful!

~Kyr

Offline Riccarr

  • BeBot User
  • **
  • Posts: 35
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #4 on: May 10, 2010, 05:53:49 am »
Thanks guys ... glad I could contribute.

Our bebot bot has become tremendously useful and taken for granted. Its amazing sometimes the new players think its part of the game. And when its down (and I haven't gotten home from work or away for the weekend) there's always a buzz to greet me from the other players (or email) BOTS DOWN! PLZ GET IT BACK UP!

Offline WeZoN

  • Global Moderator
  • *****
  • Posts: 92
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #5 on: May 11, 2010, 12:17:55 pm »
Awesome work ^^

This will make things easier.

And yeah, i know the feeling ^^  My mailbox get's spammed by those mails when the bot ever shuts down :P
(Not so much now, as i have it running as a service with firedaemon with webserver access to control it)

Conclusion: The bot has become an irreplaceable tool :P

Offline Space

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #6 on: May 18, 2010, 05:15:25 pm »
Good work all...

I used a combination of the scripts posted above, and also connected it to YG DB...
All works well except that some members get the :

[Guild] [bot]: Player ******* does not belong to this guild. Officer investigate to see if toon needs to be !member deleted

Even though in the login info it SAYS the name of OUR guild...
I am one of them BTW, and i am OWNER of bot and LORD in guild... still it says that i  dont belong to guild..?

Any idea what i have forgotten, to change in script ??..or what is wrong??


Offline Cuval

  • BeBot User
  • **
  • Posts: 29
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #7 on: May 18, 2010, 06:30:08 pm »
aoc.yg.com does not list everyone, this double check would make it a good module, people need to walk by someone who is actually scanning for YG to get listed in their DB.

Offline Getrix

  • Contributor
  • *******
  • Posts: 509
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #8 on: May 18, 2010, 07:41:28 pm »
Make sure you are using correct guildname in "!set Relay Gcname"
Success is not final, failure is not fatal: it is the courage to continue that counts.
- Sorry, i dont have time to reply question on PM. Make a topic.

Offline Space

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Identifying members who leave the guild ... a workable solution
« Reply #9 on: May 19, 2010, 10:13:03 am »
Thanx again Getrix, you are my  HEROOO!!

 :) ;) :D ;D >:( :( :o 8) ??? ::) :P :-[ :-X :-\ :-* :'(


 

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