BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => AO 0.6 support => Topic started by: crocks on December 02, 2012, 09:40:56 pm

Title: Server merge!
Post by: crocks on December 02, 2012, 09:40:56 pm
Hey everyone,
according to planning server merge at the end of 2012 (as it seems). What would be the main thing on Bebot to be able to keep the databases and all around it if the character ID will be wiped and every character will get a new ID. Bebot works mostly with Char ID as you know.

Are there any plans how to transfer the databases and bots itself to the new server with current informations the databases have? (Account informations - points, raids done, raids history, raffle history, auctions history, character alts, character permissions etc etc etc ... )

Thanks

/CR
Title: Re: Server merge!
Post by: Shelly on December 02, 2012, 11:55:36 pm
I have been pondering the same thing... The way I came up with is very manual and tedious...

1. export your current DB to a flat file
2. after merge... look up all the names for the new character ID
3. hand edit the export you did in step 1 updating the character IDs for every member/guest in the DB to the new #
4. re-load the database with your edits and restart your bot.

Not a pretty solution... but I am not a coder by nature or occupation. :)

Shelly
Title: Re: Server merge!
Post by: Glarawyn on December 04, 2012, 10:26:19 pm
What we should probably do is add some bridge tables.

BeBot Accounts:
AccountID - Unique account ID number generated by BeBot.
OldCharacterID - Premerge Character ID.
NewCharacterID - Postmerge Character ID.
OldCharacterName - Character Name
NewCharacterName - New/Current Character Name.

I'm making the assumption that some characters will get renamed due to name collisions on RK1 and RK2.

Second Bridge Table: Alt Registration using AccountID. Associate ChacterIDs (or Character Names?) with BeBot AccountIDs. 
AccountID - Foreign Key.
OldCharacterID - Only needed until merge, then it should be blank for new registrations.
NewCharacterID - New/Current Character ID. Populated after merge.
Composite Primary Key: AccountID, CharacterID.

Third Bridge Table: Display Names. 
AccountID - Foreign Key.
DisplayName - Display name for account. This would Default to the main character. Add setting to allow users to provide a custom name that does not match an AO character if they desire.


Then we need some logic for dealing with remapping IDs, looking up Alts/Mains using the new system, etc. 
Title: Re: Server merge!
Post by: Zweiblum on January 08, 2013, 11:41:59 am
so... are there any "To-Dos" for PhP newbs like me to keep the bots running after merge?
Title: Re: Server merge!
Post by: Glarawyn on February 05, 2013, 10:32:39 pm
so... are there any "To-Dos" for PhP newbs like me to keep the bots running after merge?

Find a sufficient bribe to get a BeBot coder to fix it?  :P
Title: Re: Server merge!
Post by: Glarawyn on February 26, 2013, 05:48:19 pm
For the first server merge update I'd say we should add it as another option. Then the updated BeBot could be pushed out before the server merge happens and a simple configuration change is all that's needed after the server merge.
Title: Re: Server merge!
Post by: Trypha on February 26, 2013, 05:57:57 pm
Little too late for that, servers are down for the merge now.

I have a question (I stupidly deleted the post, but I'll ask again) - Vhab posted the new server info here: http://forums.anarchy-online.com/showthread.php?t=604029

Quote
Please note this information is subject to change.

Chat server: chat.d1.funcom.com:7105
Dimensions ID: 5

We aim to have people of Rubi-Ka and other web related services available when the servers come up, but we can't guarantee they will right away at this point.

Also note, you need to log in characters using the game client before they are available on the chat server.


My question: does the $dimension variable in Bot.conf need to be "5"? If so then this is what ServerList.php would have to look like:
Code: [Select]
$server_list['ao']['Testlive']      = array('server'=>'chat.dt.funcom.com', 'port'=>7109);
$server_list['ao']['Atlantean']     = array('server'=>'chat.d1.funcom.com', 'port'=>7101);
$server_list['ao']['Rimor']         = array('server'=>'chat.d2.funcom.com', 'port'=>7102);
$server_list['ao']['Die neue welt'] = array('server'=>'chat.d3.funcom.com', 'port'=>7103);
$server_list['ao']['null to get array index right'] = array('server'=>'null', 'port'=>7104);
$server_list['ao']['Rubi-Ka'] = array('server'=>'chat.d1.funcom.com', 'port'=>7105);

Or can we just erase all those lines and replace them like this:
Code: [Select]
        $server_list['ao']['Testlive']      = array('server'=>'chat.dt.funcom.com', 'port'=>7109);
        $server_list['ao']['Rubi-Ka']     = array('server'=>'chat.d1.funcom.com', 'port'=>7105);

and then set $dimension to "1"?
Title: Re: Server merge!
Post by: Glarawyn on February 26, 2013, 10:07:46 pm
Either should work, but may as well go with the simple way and remove the old servers and replace with the new.
Title: Re: Server merge!
Post by: Ezzii on February 26, 2013, 10:18:00 pm
Here is what I have done to make it work for me.

Part I   Part II   Part III
-----------------------------

Part I
-------
In bebot/conf/Bot.conf about line 9
Code: [Select]
  $dimension = "5";                 // The name of the server you play on, or (1, 2 or 3 for AO)   was dim 1 for RK1

Part II
--------
as Trypha suggested my relavent section of bebot/conf/ServerList.conf file reads:

Code: [Select]
$server_list['ao']['Testlive'] = array(
    'server' => 'chat.dt.funcom.com',
    'port' => 7109
);
$server_list['ao']['Atlantean'] = array(
    'server' => 'chat.d1.funcom.com',
    'port' => 7101
);
$server_list['ao']['Rimor'] = array(
    'server' => 'chat.d2.funcom.com',
    'port' => 7102
);
$server_list['ao']['Die neue welt'] = array(
    'server' => 'chat.d3.funcom.com',
    'port' => 7103
);
$server_list['ao']['null to get array index right'] = array(
    'server' => 'null',
    'port' => 7104
);
$server_list['ao']['Rubi-Ka'] = array(
    'server' => 'chat.d1.funcom.com',
    'port' => 7105
);

Part III
--------
In bebot/Sources/Bot.php added case "5" as you see here around line 225

Code: [Select]
        // Get dimension server
        switch ($this->dimension) {
        case "0":
            $dimension = "Testlive";
            break;
        case "1";
            $dimension = "Atlantean";
            break;
        case "2":
            $dimension = "Rimor";
            break;
        case "3":
            $dimension = "Die neue welt";
            break;
        case "5";
            $dimension = "Rubi-Ka";
            break;
        Default:
            $dimension = ucfirst(strtolower($this->dimension));
        }

        Require("conf/ServerList.php");

// that gets you past the Unknown problem -- we'll see about the rest of the bumps.  :)

 -- Ez 
Title: Re: Server merge!
Post by: Mawerick on February 27, 2013, 05:53:51 pm
Is it really necessary to keep the null entry in the server list? or keep any of the old servers at all?
Is the server list ever accessed by index?
Title: Re: Server merge!
Post by: Ezzii on February 27, 2013, 08:01:04 pm
Yes Mawerick, probably you are right but I went forward with the extra spacing of the array to try to eliminate all possible pitfalls of not being intimately familiar with this code.

 -- Ezzii
Title: Re: Server merge!
Post by: Ezzii on February 27, 2013, 08:07:37 pm
Part IV   Part V

* If the real developers want to step in at any moment and make the clean changes then please do.  I won't be offended at all.  -- until then here is my hacking.

Although the bot can now log into the chat server side, at this point the Roster update had been failing.

Someone posted that the PoRK look up dimension is not really 5 but still 1 now.  For us in Shadow Company -- I'm not sure of old RK2 orgs having been merged but I'm guessing they are same as us and do PoRK lookups using '1'.

Part IV
--------
With your bot not running, change the table named scbot_users to scbot_users_orig
this will allow your bot to make a new clean empty user table in its rosterupdate,
plus you get to have a back up of the original.  :)

You need your mysql username for your BeBot and respective password.

mysql session below:
[scbot is the prefix/name of my bot so yours will be different in that respect. :p
 do show tables; to figure out your exact *_users table name ;)  ]

** AGAIN! DO NOT use the instructions below with scbot verbage you need your own bot name
** see above.

Code: [Select]
Ez@omni-sc ~/scbot/main $ mysql -h localhost -u scbot -p

         <you'll be prompted for your password, type'y type'y>
mysql>
mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| scbase             |
| test               |
+--------------------+
3 rows in set (0.13 sec)

mysql>
mysql> use scbase;
mysql> SHOW TABLES;

| scbot_users                |

mysql> rename table scbot_users to scbot_users_orig;

mysql> SHOW TABLES;

| scbot_users_orig           |

mysql> exit;

Ez@omni-sc ~/scbot/main $


Part V
-------
For this Part you need your new Org ID.  Ours is 4670 but yours better be differnt.  :)

So look it up.

They changed org ID's last nite on PoRK.  Ours was longer.  One good way to look it up is
goto http://people.anarchy-online.com/character/bio/d/1/name/YourToonNameAllLowerCase
(* you really have to change this URL ... the last part to your toons name in lower case)
then click your org name, then scroll to the bottom and click " XML version of this membership roster,"
then scroll back up to top and find your org ID in the XML tags.  :p  <id>4670</id>

On with the file modding:
Change the BeBot/main/10_Roster.php file here around line 316 to be like this:

Code: [Select]
        // Get the guild roster
        if ($this->bot->game == "ao") {
            $dimension = $this->bot->dimension;
            switch (strtolower($dimension)) {
            case "testlive":
                $dimension = "0";
                break;
            case "atlantean";
                $dimension = "1";
                break;
            case "rimor":
                $dimension = "2";
                break;
            case "die neue welt":
                $dimension = "3";
                break;
            case "rubi-ka";           // Addded by Ezzii
                $dimension = "5";    //
                break;              //
            }
            $members = $this->parse_org($dimension, $this->bot->guildid);


also, Change the BeBot/main/10_Roster.php file here around line 837 like this:
Make sure you use YOUR org's ID and NOT 4670!  In the line that has 4670 replace with your org's ID.
Code: [Select]
            // Get the guild roster
            $i = 0;
            $xml_roster = $this->bot->core("tools")
                // ->get_site("http://people.anarchy-online.com/org/stats/d/$dim/name/$id/basicstats.xml");  // original line
                ->get_site("http://people.anarchy-online.com/org/stats/d/1/name/4670/basicstats.xml");    //  hard coded testing line       Ezzii
            $faction = $this->bot->core("tools")


Ok having done that start the bot up and it will take a while to update the roster then add members to its friend list.

If at anytime PoRK starts using 5 instead of 1  then we'll get to do some more of this ;p .

What is still to be done I think is the !whois module looking up individual toons in the same way but I'm going to take a break for a while feel free to jump in.

 -- Ezzii
Title: Re: Server merge!
Post by: Heffalomp on February 27, 2013, 09:27:24 pm
also, Change the BeBot/main/10_Roster.php file here around line 837 like this:
Make sure you use YOUR org's ID and NOT 4670!  In the line that has 4670 replace with your org's ID.
Code: [Select]
            // Get the guild roster
            $i = 0;
            $xml_roster = $this->bot->core("tools")
                // ->get_site("http://people.anarchy-online.com/org/stats/d/$dim/name/$id/basicstats.xml");  // original line
                ->get_site("http://people.anarchy-online.com/org/stats/d/1/name/4670/basicstats.xml");    //  hard coded testing line       Ezzii
            $faction = $this->bot->core("tools")
the $xml_roster part should be like this instead:
Code: [Select]
$xml_roster = $this -> bot -> core("tools") -> get_site("http://people.anarchy-online.com/org/stats/d/1/name/$id/basicstats.xml");and set org-id in the bot's config file, especialy if running more than 1 bot from same folder (like I do). :-)
Title: Re: Server merge!
Post by: Ezzii on February 27, 2013, 09:40:06 pm
Yeh you're right Hefalomp,

All we need to hard code was $dim to 1 and nothing else.

Thanks for pointing out the right way.

 -- Ezzii
Title: Re: Server merge!
Post by: Heffalomp on February 27, 2013, 10:51:31 pm
To fix !whois

in core/ao/Whois.php change the function get_playerxml($name) (should start around line 410) so it looks like this before the $xml= part
Code: [Select]
        function get_playerxml($name)
        { // Start function get_playerxml()
                $name = strtolower($name);

                if ($this -> bot -> core("settings") -> get("Whois", "LookupOrder") == "funcom_auno")
                {
                        $site1NAME = "Anarchy-Online";
                        // $site1URL = "http://people.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml";
                        $site1URL = "http://people.anarchy-online.com/character/bio/d/1/name/" . strtolower($name) . "/bio.xml";

                        $site2NAME = "Auno";
                        // $site2URL = "http://auno.org/ao/char.php?output=xml&dimension=" . $this -> bot -> dimension . "&name=" . strtolower($name);
                        $site2URL = "http://auno.org/ao/char.php?output=xml&dimension=1&name=" . strtolower($name);
                }
                elseif ($this -> bot -> core("settings") -> get("Whois", "LookupOrder") == "funcom_only")
                {
                        $site1NAME = "Anarchy-Online";
                        // $site1URL = "http://people.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml";
                        $site1URL = "http://people.anarchy-online.com/character/bio/d/1/name/" . strtolower($name) . "/bio.xml";
                        $site2NAME = FALSE;
                }
                elseif ($this -> bot -> core("settings") -> get("Whois", "LookupOrder") == "auno_only")
                {
                        $site1NAME = "Auno";
                        // $site1URL = "http://auno.org/ao/char.php?output=xml&dimension=" . $this -> bot -> dimension . "&name=" . strtolower($name);
                        $site1URL = "http://auno.org/ao/char.php?output=xml&dimension=1&name=" . strtolower($name);
                        $site2NAME = FALSE;
                }
                else
                {
                        $site1NAME = "Auno";
                        $site1URL = "http://auno.org/ao/char.php?output=xml&dimension=" . $this -> bot -> dimension . "&name=" . strtolower($name);
                        $site2NAME = "Anarchy-Online";
                        // $site2URL = "http://people.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml";
                        $site2URL = "http://people.anarchy-online.com/character/bio/d/1/name/" . strtolower($name) . "/bio.xml";
                }
note: auno lookup will fail for all chars from rk2 until auno syncs the new rk1 exports, funcom lookup will work just fine for characters activated in game, inavtive ones will not be avaliable for lookup.
Title: Re: Server merge!
Post by: Ezzii on February 28, 2013, 02:58:03 am
Ok Heffalomp,

Really nice thanks so much!

I only added one line that maybe you over looked on purpose or not??

Code: [Select]
        ) {
            $site1NAME = "Auno";
            // $site1URL = "http://auno.org/ao/char.php?output=xml&dimension=" . $this->bot->dimension . "&name=" . strtolower($name);
            $site1URL = "http://auno.org/ao/char.php?output=xml&dimension=1&name=" . strtolower($name);                                         // Change by Heffalomp
            $site2NAME = FALSE;
        }
        else {
            $site1NAME = "Auno";
            // $site1URL = "http://auno.org/ao/char.php?output=xml&dimension=" . $this->bot->dimension . "&name=" . strtolower($name);
            $site1URL = "http://auno.org/ao/char.php?output=xml&dimension=1" . "&name=" . strtolower($name);                                    //  ** Update Added Change by Ezzii
            $site2NAME = "Anarchy-Online";
            // $site2URL = "http://people.anarchy-online.com/character/bio/d/" . $this->bot->dimension . "/name/" . strtolower($name) . "/bio.xml";
            $site2URL = "http://people.anarchy-online.com/character/bio/d/1/name/" . strtolower($name) . "/bio.xml";                            // Change by Heffalomp
        }

        $xml = $this->bot->core("tools")->get_site($site1URL);
        $xml = $this->check_xml($xml);

My whois works great again thanks to you.   :)

 -- Ezzii
Title: Re: Server merge!
Post by: Ezzii on February 28, 2013, 05:50:25 am
maybe !history   is next?

 -- Ezzii
Title: Re: Server merge!
Post by: verillo on February 28, 2013, 10:27:20 am
Hi
Change in BeBot\modules\ao\History.php: line 81

from:
Code: [Select]
$content = $this -> bot -> core("tools") -> get_site("http://auno.org/ao/char.php?output=xml&dimension=1" . $this -> bot -> dimension . "&name=".$name." ");to:
Code: [Select]
//$content = $this -> bot -> core("tools") -> get_site("http://auno.org/ao/char.php?output=xml&dimension=" . $this -> bot -> dimension . "&name=".$name." ");
$content = $this -> bot -> core("tools") -> get_site("http://auno.org/ao/char.php?output=xml&dimension=1". "&name=".$name." ");
And the character history will work.

If you use ping option on bot, in BeBot\modules\Ping.php

after:
Code: [Select]
case 3:
return "chat.d3.funcom.com";
Add:
Code: [Select]
case 5:
return "chat.d1.funcom.com";
Title: Re: Server merge!
Post by: Heffalomp on February 28, 2013, 06:29:36 pm
The whois will only be correct for Rk1 chars for the time being as it with this fix is the rk1 data from Auno that is benig parsed...
Not so much love for looking up both rk1 and 2 chars in the new world with it, if we could get the same kind of history from funcom xml instead however... :-)
Title: Re: Server merge!
Post by: Ezzii on March 01, 2013, 08:57:50 am
!history mod for both RK1 and RK2 legacy toons

This is added to just underneath vertillo's code respective to his above posting.
BeBot\modules\ao\History.php: about line 82   -- just underneath

This gives the bot a second chance to look for the toon in auno's Rk2
dimension if the first query in dimension 1 comes up with "No such character"


( The new stuff to add is remarked between "Ezzii code --------" markers )

Code: [Select]
    /*
      Get info on player
    */
    function player_history($name)
    {
        $name = ucfirst(strtolower($name));
        $id = $this->bot->core("chat")->get_uid($name);
        if (!empty($id)) {
            $output = "##blob_title##::: Character history for " . $name . " :::##end##\n\n";
            // $content = $this -> bot -> core("tools") -> get_site("http://auno.org/ao/char.php?output=xml&dimension=" . $this->bot->dimension . "&name=" . $name . " ");  // original line
            $content = $this -> bot -> core("tools") -> get_site("http://auno.org/ao/char.php?output=xml&dimension=1" . "&name=" . $name . " ");    //  new from verillo
    // -------------START of Ezzii code ----------
            $checker = 0;
            foreach ( $content as $liney ) {
                $possy = strpos( $liney, "No such character");
                if ($possy === false ) {
                        //  false stuff (nothing going on here)
                } else {
                        //  true stuff
                        $checker = $checker + 1;
                }
            }

            if ( $checker == 0 ) {
                // Zero on checker (nothing going on here)
             }
            else {
                sleep(1);
                $content = $this -> bot -> core("tools") -> get_site("http://auno.org/ao/char.php?output=xml&dimension=2" . "&name=" . $name . " ");
            }
    // -------------END of Ezzii code ----------
            if (!$content['error']) {
                $history = $this->bot->core("tools")
                    ->xmlparse($content['content'], "history");
                $events = explode("<entry", $history);
                for ($i = 1; $i < count($events); $i++) {
                    if (preg_match(
-- Ezzii

http://omni-sc.com
Title: Re: Server merge!
Post by: Heffalomp on March 02, 2013, 07:34:01 pm
The original 'core/ao/Whois.php' and 'main/10_Roster.php' should work as intended again and the temp fixes for those are not needed.
FC now exports to 'http://people.anarchy-online.com/org/stats/d/5/name/<orgid>' and 'http://people.anarchy-online.com/character/bio/d/5/name/<charname>' as intended.
Title: Re: Server merge!
Post by: Zweiblum on March 09, 2013, 06:42:41 pm
hmm whois isnt working probably.

for example Bullfrog is a lvl 26 adv in my bot. but actualy it is a 209 enfo....

i dont know why whois isnt working
Title: Re: Server merge!
Post by: Heffalomp on March 10, 2013, 04:49:33 am
hmm whois isnt working probably.

for example Bullfrog is a lvl 26 adv in my bot. but actualy it is a 209 enfo....

i dont know why whois isnt working
Are you running with the temp whois mods we posted here or the original whois module? (should be using the original now)
Also, did you remember to clean the whois table in your db after merge?
Title: Re: Server merge!
Post by: Zweiblum on March 10, 2013, 11:00:06 am
ah thx!
i didnt whiped the whois table.

its now working, thx ;)
Title: Re: Server merge!
Post by: Khalem on March 16, 2013, 11:56:24 pm
I've kept half an eye on this thread and first of all I want to thank everyone that contributed.

I have committed fixes for most issues to the BeBot-legacy repository on github. You can get the latest code from https://github.com/J-Soft/BeBot-legacy/archive/master.zip

Feedback would be most welcome before i promote this as a release.

Please note that $dimension should now read "Rubi-Ka" and you will need to add $conf_version = 1; to your config file to make the bot start.
Title: Re: Server merge!
Post by: Dontask on March 18, 2013, 03:52:05 am
Here is a little function for restoring !logons since character IDs were reset on merge. This is only relevant if you backed up your old whois table. I named mine whois_old so you will need to change that if needed.

Either make a new module out of this or add it to some existing module temporarily.

Code: [Select]
function updatelogons(){
$idupdates = 0;
$oldid = $this -> bot -> db -> select("SELECT id FROM #___logon");
foreach ($oldid as $id){
$name = $this -> bot -> db -> select("SELECT nickname FROM #___whois_old WHERE ID = '$id[0]'");
$newid = $this -> bot -> db -> select("SELECT ID FROM #___whois WHERE nickname = '" . $name[0][0] . "'");
if(!(empty($newid))){
$this -> bot -> db -> query("UPDATE #___logon SET id = '" . $newid[0][0] . "' WHERE id = '$id[0]'");
$idupdates++;
}
}
return "Selected " . count($oldid) . " IDs. Updated " . $idupdates . ".";
}

If someone feels like adding to this by looking information up from AUNO or some other source be my guest.
SimplePortal 2.3.7 © 2008-2024, SimplePortal