Conquer Club

Script: Team PM - Version 1.0.1

The home of third-party tools and utilities that can enhance your Conquer Club experience.

Moderator: Tech Team

Forum rules
Please read the Community Guidelines before posting.

Re: Script: Team PM - Version 1.0.0

Postby dgz345 on Tue Aug 26, 2014 4:15 pm

I'll be able to check and confirm this bug. And then hopefully find what's wrong and mend it.
User avatar
Lieutenant dgz345
 
Posts: 1380
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Team PM - Version 1.0.0

Postby RobbieDub on Tue Aug 26, 2014 6:05 pm

thanks I turned assault odds back on and it isn't doing the crazy stuff but I have left the other two off especially since chatglove is acting a little funny anyways.
Thanks for all the work you do with the scripts dgz
Highest Rank Colonel with 2932
Image
User avatar
Captain RobbieDub
 
Posts: 433
Joined: Fri Aug 21, 2009 1:12 am
Location: Salt Spring Island

Re: Script: Team PM - Version 1.0.0

Postby RobbieDub on Tue Oct 21, 2014 10:44 am

I'm still having trouble when I use the Team PM script. It stops the panel interface from updating my moves during a turn resulting in the snapshot at the end of my turn being the look of the map at the start of my turn. Also if I want to fort it shows the territories I have taken as still being owned by the other player although I can still fort to it.
Highest Rank Colonel with 2932
Image
User avatar
Captain RobbieDub
 
Posts: 433
Joined: Fri Aug 21, 2009 1:12 am
Location: Salt Spring Island

Re: Script: Team PM - Version 1.0.0

Postby conrwronski on Sat Oct 25, 2014 9:48 am

use Internet explorer or Chrome to have it work right, have some other glitched with IE so I now use Chrome for CC games.
Major conrwronski
 
Posts: 8
Joined: Sun Nov 06, 2011 11:01 pm

Re: Script: Team PM - Version 1.0.0

Postby The_Samurai on Sat Oct 25, 2014 2:32 pm

I confirm that it works smoothly with Chrome.
___________________________________________________________
Best rank: Brigadier - ranked #45 | high score 3306 | 6 August 2015
Proud member of The Republic clan, and Co-leader of FBRD tribe
User avatar
Major The_Samurai
 
Posts: 991
Joined: Wed Nov 17, 2010 7:38 am

Re: Script: Team PM - Version 1.0.0

Postby judge_reinhold on Wed Dec 24, 2014 11:25 pm

The script is mangling the subject line of messages. It also has the entire jquery library (many kilobytes) copied into it.

So I fixed the subject line bug and removed jquery from the code and instead added a "@require" to the top of the script. Whoever is in charge of this, here you go. Free service from me.


// ==UserScript==
// @name Conquer Club - Team PM
// @version 1.0.1
// @namespace http://tools.conquerclub.com/
// @description Adds a button in team games to private message entire team
// @author ThrushAAX, edited by Foxglove. edited 20141224 as a Christmas gift from jr
// @require http://code.jquery.com/jquery-latest.js
// @include http://www.conquerclub.com/game.php?game=*
// @include https://www.conquerclub.com/game.php?game=*
// @match *://*.conquerclub.com/game.php?game=*
// ==/UserScript==

var gamenumber = 0;
var username = null;

if(/www.conquerclub.com\/game.php\?game=(\d+)/.test(window.location.href) ){
gamenumber = RegExp.$1;

if(gamenumber){
$.get("/api.php", {
mode: "gamelist",
gn: gamenumber
}, doWork, "xml");
}
}

function getMyName(){
if(username) return username;

username = $("#this_username").text();

return username;
}

function doWork(xml){

var $xml = $(xml);

if( $xml.find("games").attr("total") != "1"){ //should only have 1 game so pretty big problem otherwise
return;
}

var $game = $xml.find("game");

//get type
var type = $game.children("game_type").text();
var teamsize;

if( type == 'Q' ){
teamsize = 4;
type = 'quadruples';
}
else if( type == 'T'){
teamsize = 3;
type = 'triples';
}
else if( type == 'D'){
teamsize = 2;
type = 'doubles';
}
else { // some other type we don't care about
return;
}

//get players ids
var playerids = [];
var myindex = -1;

for(var i = 1; i <= 12; i++){
var a = $("#stat_rank_"+i);

if( !a.length){ // didn't find the item, so no more players
break;
}

if(/u=(\d+)/.test( a.attr("href") )){
playerids.push(RegExp.$1);

var playername = $("#stat_player_"+i).text().split(":")[1];

if(playername == getMyName() ){
myindex = i - 1;
}
}
}

if( myindex < 0){ // I'm not in this game!
return;
}

var mapname = $game.children("map").text();
var myid = playerids[myindex];
var startindex;

//if( teamsize == 2 ){ //handle doubles
// startindex = (Math.floor(myindex / 2) * 2);
//}
//else { //handle tripples and quads
// startindex = myindex < teamsize ? 0 : teamsize;
//}
startindex = myindex < teamsize ? 0 : (Math.floor(myindex / teamsize) * teamsize);

// get the ids of the people in your team excluding yourself
var teamplayers = playerids.splice(startindex,teamsize);
teamplayers.splice(teamplayers.indexOf(myid),1);

var tourneyname = ''; // added by jr
if($("#tournament_info").length > 0 ) { // added by jr
tourneyname = $("#tournament_info span a").text();
}

// var tourneyname = $("#dashboard").find("td:contains(Tournament:)").find("a").text(); // commented by jr
var subject = mapname+' ';
if( tourneyname ){
subject += 'for '+tourneyname;
}
else {
subject += type;
}
subject = subject.substring(0,60); //max length for subjects

//make fake post form to add users to pm form
var form='<form id="PMTEAMFORM" method="post" target="_blank" action="/forum/ucp.php?i=pm&mode=compose">';

for( var i = 0; i < teamplayers.length - 1; i++){
form += '<input type="hidden" name="address_list[u]['+ teamplayers[i] +']" value="to"/>';
}

// required to get form not to give error..
form += '<input type="hidden" name="add_to['+teamplayers[teamplayers.length-1] +']" value="Add"/>';

form += '<input type="hidden" name="subject" value="'+subject+'"/>'
form += '<input type="hidden" name="message" value="[Game]'+gamenumber+'[/Game]"/>'
form += '<input type="submit" name="" value="" style="display:none;" />'
form += '</form>';


$('<button>PM Teammates</button>').insertAfter("#players").click(function(){
var evt = document.createEvent("HTMLEvents");
evt.initEvent("submit", true, true);
// tries to submit the form in two different ways for chrome and FF
$(form).insertAfter("#chat-form").submit().get(0).dispatchEvent(evt);
});

}
Colonel judge_reinhold
 
Posts: 110
Joined: Sun Sep 02, 2012 10:59 pm
Location: meat

Re: Script: Team PM - Version 1.0.0

Postby dgz345 on Thu Dec 25, 2014 12:53 pm

judge_reinhold wrote:The script is mangling the subject line of messages. It also has the entire jquery library (many kilobytes) copied into it.

So I fixed the subject line bug and removed jquery from the code and instead added a "@require" to the top of the script. Whoever is in charge of this, here you go. Free service from me.

Code: Select all
// ==UserScript==
// @name          Conquer Club - Team PM
// @version       1.0.1
// @namespace     http://tools.conquerclub.com/
// @description   Adds a button in team games to private message entire team
// @author        ThrushAAX, edited by Foxglove. edited 20141224 as a Christmas gift from jr
// @require http://code.jquery.com/jquery-latest.js
// @include       http://www.conquerclub.com/game.php?game=*
// @include       https://www.conquerclub.com/game.php?game=*
// @match         *://*.conquerclub.com/game.php?game=*
// ==/UserScript==

var gamenumber = 0;
var username = null;

if(/www.conquerclub.com\/game.php\?game=(\d+)/.test(window.location.href) ){
    gamenumber = RegExp.$1;

    if(gamenumber){
        $.get("/api.php", {
            mode: "gamelist",
            gn: gamenumber
        }, doWork, "xml");
    }
}

function getMyName(){
    if(username) return username;
   
    username = $("#this_username").text();
   
    return username;
}

function doWork(xml){
   
    var $xml = $(xml);
   
    if( $xml.find("games").attr("total") != "1"){   //should only have 1 game so pretty big problem otherwise
        return;
    }
   
    var $game = $xml.find("game");

    //get type
    var type = $game.children("game_type").text();
    var teamsize;
   
    if( type == 'Q' ){
        teamsize = 4;
        type = 'quadruples';
    }
    else if( type == 'T'){
        teamsize = 3;
        type = 'triples';
    }
    else if( type == 'D'){
        teamsize = 2;
        type = 'doubles';
    }
    else { // some other type we don't care about
        return;
    }
   
    //get players ids
    var playerids = [];
    var myindex = -1;
   
    for(var i = 1; i <= 12; i++){
        var a = $("#stat_rank_"+i);
       
        if( !a.length){ // didn't find the item, so no more players
            break;
        }
       
        if(/u=(\d+)/.test( a.attr("href") )){
            playerids.push(RegExp.$1);
           
            var playername = $("#stat_player_"+i).text().split(":")[1];
       
            if(playername == getMyName() ){
                myindex = i - 1;
            }
        }
    }   
   
    if( myindex < 0){      // I'm not in this game!
        return;
    }
   
    var mapname = $game.children("map").text();
    var myid = playerids[myindex];
    var startindex;
   
    //if( teamsize == 2 ){   //handle doubles
    //    startindex = (Math.floor(myindex / 2) * 2);
    //}
    //else {  //handle tripples and quads
    //    startindex = myindex < teamsize ? 0 : teamsize;
    //}
    startindex = myindex < teamsize ? 0 : (Math.floor(myindex / teamsize) * teamsize);
   
    // get the ids of the people in your team excluding yourself
    var teamplayers = playerids.splice(startindex,teamsize);
    teamplayers.splice(teamplayers.indexOf(myid),1);
   
    var tourneyname = ''; // added by jr
    if($("#tournament_info").length > 0 ) { // added by jr
       tourneyname = $("#tournament_info span a").text();
    }
   
    // var tourneyname = $("#dashboard").find("td:contains(Tournament:)").find("a").text(); // commented by jr
    var subject = mapname+' ';
    if( tourneyname ){
        subject += 'for '+tourneyname;
    }
    else {
        subject += type;
    }
    subject = subject.substring(0,60);  //max length for subjects
   
    //make fake post form to add users to pm form   
    var form='<form id="PMTEAMFORM" method="post" target="_blank" action="/forum/ucp.php?i=pm&mode=compose">';
   
    for( var i = 0; i < teamplayers.length - 1; i++){
        form += '<input type="hidden" name="address_list[u]['+ teamplayers[i] +']" value="to"/>';
    }
   
    // required to get form not to give error..
    form += '<input type="hidden" name="add_to['+teamplayers[teamplayers.length-1] +']" value="Add"/>';
   
    form += '<input type="hidden" name="subject" value="'+subject+'"/>'
    form += '<input type="hidden" name="message" value="[Game]'+gamenumber+'[/Game]"/>'
    form += '<input type="submit" name="" value="" style="display:none;" />'
    form += '</form>';
   

    $('<button>PM Teammates</button>').insertAfter("#players").click(function(){
        var evt = document.createEvent("HTMLEvents");
   evt.initEvent("submit", true, true);
        // tries to submit the form in two different ways for chrome and FF
        $(form).insertAfter("#chat-form").submit().get(0).dispatchEvent(evt);
    });
   
}


i tested it and checked the code. it should work without problems. tho i removed your name from the code. your name is in the changelog. i dont want to bloat the code with names when i hope more of the community will help updating these scripts then it will be like 20 names inside the code. so your name is on the changelog for this version.

also i will give you 600 CC credits. as thanks. maybe its a little much for this small update. but i still want to point out that im rewarding this kind of things and hopefully encouraging other ppl to create scripts and update them.
User avatar
Lieutenant dgz345
 
Posts: 1380
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Team PM - Version 1.0.1

Postby EBConquer on Sat Apr 09, 2016 9:58 pm

Is it safe to say that this Handy Script is dead in the water?
Image
User avatar
Colonel EBConquer
 
Posts: 973
Joined: Sun Dec 05, 2010 1:11 am
Location: San Diego

Re: Script: Team PM - Version 1.0.1

Postby RobbieDub on Sun Apr 10, 2016 11:14 pm

I'm using it on Firefox but I turn it on and off through grease monkey when I need it because it screws up the snapshot function
Highest Rank Colonel with 2932
Image
User avatar
Captain RobbieDub
 
Posts: 433
Joined: Fri Aug 21, 2009 1:12 am
Location: Salt Spring Island

Re: Script: Team PM - Version 1.0.1

Postby dgz345 on Mon Apr 11, 2016 9:25 am

RobbieDub wrote:I'm using it on Firefox but I turn it on and off through grease monkey when I need it because it screws up the snapshot function


how it screws up the snapshot i have no clue. this is what Team PM does
1. check if its a game page then get the api call for that game.
2. check if its Quad Trip or Dubs. check what team u are on
3. creates a fake message form to the other users.

so the problem should then be in createing the fake form. and i dont see how that would mess something up :/ but this is a known problem users are having. i just cant find a solution


im mostly testing with chrome. but it works on Chrome and FF.
User avatar
Lieutenant dgz345
 
Posts: 1380
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Team PM - Version 1.0.1

Postby Silly Knig-it on Sun Dec 03, 2017 6:16 am

I was doing what RobbieDub was doing and was okay with that. Since the Firefox upgrade none of the greasemonkey extensions work for me.

Firefox Quantum 57.0.1
Mac OS High Sierra 10.13.1

Update: I played around and learned to install Tampermonkey and this script works for me now.
Image
User avatar
Sergeant 1st Class Silly Knig-it
SoC Training Adviser
 
Posts: 2996
Joined: Sat May 28, 2011 12:21 am
Location: Everett, WA

Re: Script: Team PM - Version 1.0.1

Postby RobbieDub on Tue Dec 05, 2017 12:01 pm

Silly Knig-it wrote:I was doing what RobbieDub was doing and was okay with that. Since the Firefox upgrade none of the greasemonkey extensions work for me.

Firefox Quantum 57.0.1
Mac OS High Sierra 10.13.1

Update: I played around and learned to install Tampermonkey and this script works for me now.


are you using tampermoney on firefox?
I switched to Chrome and use tampermoney now and it works well.
Highest Rank Colonel with 2932
Image
User avatar
Captain RobbieDub
 
Posts: 433
Joined: Fri Aug 21, 2009 1:12 am
Location: Salt Spring Island

Re: Script: Team PM - Version 1.0.1

Postby Silly Knig-it on Tue Dec 05, 2017 12:44 pm

RobbieDub wrote:
Silly Knig-it wrote:I was doing what RobbieDub was doing and was okay with that. Since the Firefox upgrade none of the greasemonkey extensions work for me.

Firefox Quantum 57.0.1
Mac OS High Sierra 10.13.1

Update: I played around and learned to install Tampermonkey and this script works for me now.


are you using tampermonkey on firefox?
I switched to Chrome and use tampermoney now and it works well.


Yes, tampermonkey on firefox
Image
User avatar
Sergeant 1st Class Silly Knig-it
SoC Training Adviser
 
Posts: 2996
Joined: Sat May 28, 2011 12:21 am
Location: Everett, WA

Re: Script: Team PM - Version 1.0.1

Postby Major bob on Thu Dec 21, 2017 6:19 pm

what script?
User avatar
Sergeant Major bob
 
Posts: 30
Joined: Mon Feb 20, 2012 9:41 pm
Location: Gatineau, Quebec, Canada

Re: Script: Team PM - Version 1.0.1

Postby Major bob on Thu Dec 21, 2017 6:20 pm

Silly Knig-it wrote:
RobbieDub wrote:
Silly Knig-it wrote:I was doing what RobbieDub was doing and was okay with that. Since the Firefox upgrade none of the greasemonkey extensions work for me.

Firefox Quantum 57.0.1
Mac OS High Sierra 10.13.1

Update: I played around and learned to install Tampermonkey and this script works for me now.


are you using tampermonkey on firefox?
I switched to Chrome and use tampermoney now and it works well.


Yes, tampermonkey on firefox


So what script are we talking about here and where is it?
User avatar
Sergeant Major bob
 
Posts: 30
Joined: Mon Feb 20, 2012 9:41 pm
Location: Gatineau, Quebec, Canada

Re: Script: Team PM - Version 1.0.1

Postby Major bob on Thu Dec 21, 2017 6:25 pm

318 users on line and no one can tell me how to install an attack simulation add-on?
User avatar
Sergeant Major bob
 
Posts: 30
Joined: Mon Feb 20, 2012 9:41 pm
Location: Gatineau, Quebec, Canada

Re: Script: Team PM - Version 1.0.1

Postby RobbieDub on Mon Jan 08, 2018 12:10 am

Major bob wrote:318 users on line and no one can tell me how to install an attack simulation add-on?


Hey Bob,
Here's where you go for the add ons
http://tools.conquerclub.com/
Assault Odds tells you your chances on winning an attack.
Seems like tampermonkey on firefox or chrome works to make these add ons work
Cheers, rob
Highest Rank Colonel with 2932
Image
User avatar
Captain RobbieDub
 
Posts: 433
Joined: Fri Aug 21, 2009 1:12 am
Location: Salt Spring Island

Re: Script: Team PM - Version 1.0.0

Postby agentcom on Wed Jan 31, 2018 3:22 pm

RobbieDub wrote:Hey I'm having problems with the panel interface auto snapshots and it seems to be connected to the Team PM script. When the script is active the snapshot is from the start of the turn when I'm really at the end of the turn. When I turn that particular script off the snapshots work fine. Here is some info from my bug report.

Operating System: OS x 10.9.4
Browser: Firefox 31
Scripts/third party programs used: assault odds 2.0.3, chatglove 1.8.1, Team PM 1.0.0

The auto snapshot taken with the panel interface at the end of the turn shows a picture of the map at the start of the turn in all of my active games. I have to leave the game and return to it to get an accurate snapshot of the map after my turn.


OMG, it was Team PM that was doing that to me for all these months?!?! I think it was over a year. What I would do is refresh the screen prior to taking the snap. An incidental benefit of the bug was that it I ever forgot how many troops were on a territ (or whatever) at the start of the turn, I could just press the snap button to refresh my memory. It was actually pretty useful sometimes. But mostly annoying.
User avatar
Colonel agentcom
 
Posts: 3980
Joined: Tue Nov 09, 2010 8:50 pm

Re: Script: Team PM - Version 1.0.0

Postby agentcom on Wed Jan 31, 2018 3:26 pm

dgz345 wrote:
also i will give you 600 CC credits. as thanks. maybe its a little much for this small update. but i still want to point out that im rewarding this kind of things and hopefully encouraging other ppl to create scripts and update them.


This is great to hear!

And perfect timing, too. It sounds like I should finally ditch firefox, which I was using only for CC and only because of the add-ons that were available. Reading through the last page or so of this thread, it sounds like Chrome is now the more reliable way to keep these add-ons running.
User avatar
Colonel agentcom
 
Posts: 3980
Joined: Tue Nov 09, 2010 8:50 pm

Re: Script: Team PM - Version 1.0.0

Postby RobbieDub on Thu Feb 01, 2018 3:08 pm

agentcom wrote:
dgz345 wrote:
also i will give you 600 CC credits. as thanks. maybe its a little much for this small update. but i still want to point out that im rewarding this kind of things and hopefully encouraging other ppl to create scripts and update them.


This is great to hear!

And perfect timing, too. It sounds like I should finally ditch firefox, which I was using only for CC and only because of the add-ons that were available. Reading through the last page or so of this thread, it sounds like Chrome is now the more reliable way to keep these add-ons running.


Yeah Chrome is rocking for me right now. Add-ons are working seemlessly
Highest Rank Colonel with 2932
Image
User avatar
Captain RobbieDub
 
Posts: 433
Joined: Fri Aug 21, 2009 1:12 am
Location: Salt Spring Island

Re: Script: Team PM - Version 1.0.1

Postby Fewnix on Fri Feb 02, 2018 1:38 pm

This may be the spot where I, a non-techie, can get some help after switching to Chrome/Tampermonkey, getting Team PM working, Map Rank working but not getting Assault Odds working.

This is what I get on the menu when I am in a game.
Assault Odds 2.0.4
Options
Latest Version Installed

even after re-installing Assault Odds

chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/ask.html?aid=14dc973a-54bf-42b1-a26c-16512a9f5e27

and getting this in my dashboard

# Enabled Name ▴ Version Sites Features Homepage Last updated Actions
3
Conquer Club - Assault Odds 2.0.4
http*://*.conquerclub.com*/game.php* 26 h
2
Conquer Club - Team PM 1.0.1
http://www.conquerclub.com/game.php?game=* 33 d
1
Conquer Club Map Rank GL temp fix by dgz345
----

So I am sure its me, a non techie who can;t even get a decent screen shot, help please- do I need to remove Team PM and Map Rank, or do some simple click of the mouse to get Assault Odds working.

Thanks
Rule 1
show
User avatar
Private Fewnix
 
Posts: 1245
Joined: Sat Apr 25, 2009 2:15 am
2

Re: Script: Team PM - Version 1.0.1

Postby RobbieDub on Fri Feb 02, 2018 3:46 pm

Hmm my dashboard looks the same but I added Map Rank later. Maybe delete maprank and see if assault odds works then.
I also keep assault odds in its own window on the game page if that makes a difference for some reason.
Highest Rank Colonel with 2932
Image
User avatar
Captain RobbieDub
 
Posts: 433
Joined: Fri Aug 21, 2009 1:12 am
Location: Salt Spring Island

Re: Script: Team PM - Version 1.0.1

Postby Fewnix on Fri Feb 02, 2018 8:53 pm

No go. Deleted Map Rank and Team PM and, after deleting Assault Odds, reinstalled Assault Odds. Still get this in games:

Assault Odds 2.0.4
Options
Latest Version Installed

and dummy that I am, no idea how to make it work. If it works.

Dashboard

Tampermonkey®
v4.5 by Jan Biniok
Installed userscripts
Settings
Utilities
Help
# Enabled Name ▴ Version Sites Features Homepage Last updated Actions
1
Conquer Club - Assault Odds 2.0.4
http*://*.conquerclub.com*/game.php* 33 h

Help? :cry:
RobbieDub wrote:Hmm my dashboard looks the same but I added Map Rank later. Maybe delete maprank and see if assault odds works then.
I also keep assault odds in its own window on the game page if that makes a difference for some reason.
Rule 1
show
User avatar
Private Fewnix
 
Posts: 1245
Joined: Sat Apr 25, 2009 2:15 am
2

Previous

Return to Third-Party Tools & Enhancements

Who is online

Users browsing this forum: dwilhelmi