vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Major Additions - Realm Conquest System (https://vborg.vbsupport.ru/showthread.php?t=211920)

Collussus 05-04-2009 09:07 PM

Quote:

Originally Posted by Sugoi na (Post 1804406)
That would actually be much better then my original idea. I hope you are willing to release it as an addon =)

Good work!

I fixed it up the ugly way. No plugins since there's no hooks in his add-on whatsoever, so i'm afraid you're gonna have to dig up the php files....

open up conquest.php

replace the whole
PHP Code:

if ($_REQUEST['do'] == 'enlist')
{
    
$totals =  $vbulletin->db->query_first("SELECT COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_players AS conquest_players
    "
);

    if (!
$totals['playerID']) { $totals['playerID'] = 1; }
    if (!
$totals['pGold']) { $totals['pGold'] = 1; }
    if (!
$totals['pTroops']) { $totals['pTroops'] = 1; }

    
$nations $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);

    while (
$nation $vbulletin->db->fetch_array($nations))
    {
        if (
file_exists($thumbdir.'/nations/'.$nation['nationID'].'.jpg')) { $imageE true; } else { $imageE false; }
        
$nation['AVGplayerID'] = number_format($nation['playerID'] / $totals['playerID'] * 1002);
        
$nation['AVGpGold'] = number_format($nation['pGold'] / $totals['pGold'] * 1002);
        
$nation['AVGpTroops'] = number_format($nation['pTroops'] / $totals['pTroops'] * 1002);
        eval(
'$nationsHTML .= "' fetch_template('conquest_enlist_bit') . '";');
    }

    
$pageNAME $vbphrase['conquest_enlist'];
    eval(
'$conquestHTML .= "' fetch_template('conquest_enlist') . '";'); 

    
$navbits[] = $pageNAME
    
$navbits construct_navbits($navbits); 

    eval(
'$navbar = "' fetch_template('navbar') . '";'); 
    eval(
'print_output("' fetch_template('conquest_SHELL') . '");');


with

PHP Code:

if ($_REQUEST['do'] == 'enlist')
{
    
$totals =  $vbulletin->db->query_first("SELECT COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_players AS conquest_players
    "
);
    if (!
$totals['playerID']) { $totals['playerID'] = 1; }
    if (!
$totals['pGold']) { $totals['pGold'] = 1; }
    if (!
$totals['pTroops']) { $totals['pTroops'] = 1; }

    
$nations $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);
    
$nationsagain $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);
    
$totaleverything = array();
    while(
$nation2 $vbulletin->db->fetch_array($nationsagain))
    {
        
$totaleverything[] = number_format((($nation2['playerID']) + ($nation2['pTroops'])) / ($totals['playerID'] + $totals['pTroops']) * 1002);
        
    }
    
$id 0;
    while (
$nation $vbulletin->db->fetch_array($nations))
    {    
        if(!(
$totaleverything[$id] >= 33))
        {
            if (
file_exists($thumbdir.'/nations/'.$nation['nationID'].'.jpg')) { $imageE true; } else { $imageE false; }
                
$nation['AVGplayerID'] = number_format($nation['playerID'] / $totals['playerID'] * 1002);
                
$nation['AVGpGold'] = number_format($nation['pGold'] / $totals['pGold'] * 1002);
                
$nation['AVGpTroops'] = number_format($nation['pTroops'] / $totals['pTroops'] * 1002);
                eval(
'$nationsHTML .= "' fetch_template('conquest_enlist_bit') . '";');
        }
        
$id ++;
    }
    
    
$pageNAME $vbphrase['conquest_enlist'];
    eval(
'$conquestHTML .= "' fetch_template('conquest_enlist') . '";'); 
    
    
$navbits[] = $pageNAME
    
$navbits construct_navbits($navbits); 

    eval(
'$navbar = "' fetch_template('navbar') . '";'); 
    eval(
'print_output("' fetch_template('conquest_SHELL') . '");');



In this whole code i set it for 3 nations. Which means that if a nation is bigger than 33.33 percent it will not show on the enlist screen anymore.

You can change this setting here:

PHP Code:

if(!($totaleverything[$id] >= 33)) 



I know i fixed this up the ugly way, i'm sure the original maker will know a way to do this the good way. This was just my fast fix.

Sugoi na 05-04-2009 09:38 PM

Quote:

Originally Posted by Collussus (Post 1804652)
I fixed it up the ugly way. No plugins since there's no hooks in his add-on whatsoever, so i'm afraid you're gonna have to dig up the php files....

open up conquest.php

replace the whole
PHP Code:

if ($_REQUEST['do'] == 'enlist')
{
    
$totals =  $vbulletin->db->query_first("SELECT COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_players AS conquest_players
    "
);

    if (!
$totals['playerID']) { $totals['playerID'] = 1; }
    if (!
$totals['pGold']) { $totals['pGold'] = 1; }
    if (!
$totals['pTroops']) { $totals['pTroops'] = 1; }

    
$nations $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);

    while (
$nation $vbulletin->db->fetch_array($nations))
    {
        if (
file_exists($thumbdir.'/nations/'.$nation['nationID'].'.jpg')) { $imageE true; } else { $imageE false; }
        
$nation['AVGplayerID'] = number_format($nation['playerID'] / $totals['playerID'] * 1002);
        
$nation['AVGpGold'] = number_format($nation['pGold'] / $totals['pGold'] * 1002);
        
$nation['AVGpTroops'] = number_format($nation['pTroops'] / $totals['pTroops'] * 1002);
        eval(
'$nationsHTML .= "' fetch_template('conquest_enlist_bit') . '";');
    }

    
$pageNAME $vbphrase['conquest_enlist'];
    eval(
'$conquestHTML .= "' fetch_template('conquest_enlist') . '";'); 

    
$navbits[] = $pageNAME
    
$navbits construct_navbits($navbits); 

    eval(
'$navbar = "' fetch_template('navbar') . '";'); 
    eval(
'print_output("' fetch_template('conquest_SHELL') . '");');


with

PHP Code:

if ($_REQUEST['do'] == 'enlist')
{
    
$totals =  $vbulletin->db->query_first("SELECT COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_players AS conquest_players
    "
);
    if (!
$totals['playerID']) { $totals['playerID'] = 1; }
    if (!
$totals['pGold']) { $totals['pGold'] = 1; }
    if (!
$totals['pTroops']) { $totals['pTroops'] = 1; }

    
$nations $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);
    
$nationsagain $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);
    
$totaleverything = array();
    while(
$nation2 $vbulletin->db->fetch_array($nationsagain))
    {
        
$totaleverything[] = number_format((($nation2['playerID']) + ($nation2['pGold']) + ($nation2['pTroops'])) / ($totals['playerID'] +  $totals['pGold'] +  $totals['pTroops']) * 1002);
        
    }
    
$id 0;
    while (
$nation $vbulletin->db->fetch_array($nations))
    {    
        if(!(
$totaleverything[$id] >= 33))
        {
            if (
file_exists($thumbdir.'/nations/'.$nation['nationID'].'.jpg')) { $imageE true; } else { $imageE false; }
                
$nation['AVGplayerID'] = number_format($nation['playerID'] / $totals['playerID'] * 1002);
                
$nation['AVGpGold'] = number_format($nation['pGold'] / $totals['pGold'] * 1002);
                
$nation['AVGpTroops'] = number_format($nation['pTroops'] / $totals['pTroops'] * 1002);
                eval(
'$nationsHTML .= "' fetch_template('conquest_enlist_bit') . '";');
        }
        
$id ++;
    }
    
    
$pageNAME $vbphrase['conquest_enlist'];
    eval(
'$conquestHTML .= "' fetch_template('conquest_enlist') . '";'); 
    
    
$navbits[] = $pageNAME
    
$navbits construct_navbits($navbits); 

    eval(
'$navbar = "' fetch_template('navbar') . '";'); 
    eval(
'print_output("' fetch_template('conquest_SHELL') . '");');



In this whole code i set it for 3 nations. Which means that if a nation is bigger than 33.33 percent it will not show on the enlist screen anymore.

You can change this setting here:

PHP Code:

if(!($totaleverything[$id] >= 33)) 



I know i fixed this up the ugly way, i'm sure the original maker will know a way to do this the good way. This was just my fast fix.


Hey it's better then nothing =)

I will give it a shot for now & hopefully Jaxel can work his magic!

Great job none the less!

ghostiya 05-04-2009 10:01 PM

im still suck on the user privalieges they dont show can any1 give me a screen shot ot tell me what to do?

Sugoi na 05-05-2009 01:42 AM

Quote:

Originally Posted by ghostiya (Post 1804683)
im still suck on the user privalieges they dont show can any1 give me a screen shot ot tell me what to do?

Set up the privileges through the forums admin CP first.

Once your admin rights are all set visit the game at www.yoursite.com/forum/conquest.php

Once you choose your nation you will see all of the admin rights on the left side for the game. Simply set all of the rights & choose the reset option. Once that's all set configure the usergroups permissions for registered users & any other user groups you may have.

Viola!

Enjoy!

Collussus 05-05-2009 08:11 AM

Quote:

Originally Posted by Sugoi na (Post 1804669)
Hey it's better then nothing =)

I will give it a shot for now & hopefully Jaxel can work his magic!

Great job none the less!

After testing it out for a day on my forum i decided i made a huge mistake. I shouldn't have added the gold into the calculation. Will remove this later today.

EDIT:

This is the new code :

PHP Code:

if ($_REQUEST['do'] == 'enlist')
{
    
$totals =  $vbulletin->db->query_first("SELECT COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_players AS conquest_players
    "
);
    if (!
$totals['playerID']) { $totals['playerID'] = 1; }
    if (!
$totals['pGold']) { $totals['pGold'] = 1; }
    if (!
$totals['pTroops']) { $totals['pTroops'] = 1; }

    
$nations $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);
    
$nationsagain $vbulletin->db->query_read("SELECT conquest_nations.*, COUNT(playerID) AS playerID, SUM(pGold) AS pGold, SUM(pTroops) AS pTroops
        FROM "
.TABLE_PREFIX."conquest_nations AS conquest_nations
        LEFT JOIN "
.TABLE_PREFIX."conquest_players AS conquest_players ON conquest_nations.nationID = conquest_players.nationID
        GROUP BY conquest_nations.nationID
    "
);
    
$totaleverything = array();
    while(
$nation2 $vbulletin->db->fetch_array($nationsagain))
    {
        
$totaleverything[] = number_format((($nation2['playerID']) + ($nation2['pTroops'])) / ($totals['playerID'] + $totals['pTroops']) * 1002);
        
    }
    
$id 0;
    while (
$nation $vbulletin->db->fetch_array($nations))
    {    
        if(!(
$totaleverything[$id] >= 33))
        {
            if (
file_exists($thumbdir.'/nations/'.$nation['nationID'].'.jpg')) { $imageE true; } else { $imageE false; }
                
$nation['AVGplayerID'] = number_format($nation['playerID'] / $totals['playerID'] * 1002);
                
$nation['AVGpGold'] = number_format($nation['pGold'] / $totals['pGold'] * 1002);
                
$nation['AVGpTroops'] = number_format($nation['pTroops'] / $totals['pTroops'] * 1002);
                eval(
'$nationsHTML .= "' fetch_template('conquest_enlist_bit') . '";');
        }
        
$id ++;
    }
    
    
$pageNAME $vbphrase['conquest_enlist'];
    eval(
'$conquestHTML .= "' fetch_template('conquest_enlist') . '";'); 
    
    
$navbits[] = $pageNAME
    
$navbits construct_navbits($navbits); 

    eval(
'$navbar = "' fetch_template('navbar') . '";'); 
    eval(
'print_output("' fetch_template('conquest_SHELL') . '");');


Will edit this in previous post too.

Collussus 05-05-2009 12:36 PM

Sorry for double post but i wanted to ask if someone was interested in the code modification i made where it makes it impossible for people under 250 troops to be attacked? (Some kind of newbie / raid protection)

MAK-upl 05-05-2009 02:59 PM

Very, very good idea Jaxel!!!

Collussus good point. It would be pointless to play a game, where some "highlevel" player is ganking all newbies.

greenspan 05-05-2009 03:02 PM

Hi. Is there a possibility to just have two nations instead of three? Thanks.

Sugoi na 05-05-2009 03:21 PM

Quote:

Originally Posted by greenspan (Post 1805087)
Hi. Is there a possibility to just have two nations instead of three? Thanks.

This is the admins option. The default is 3 but you can easily delete one & edit the stats of the remaining 2!

All in the Admin Nations option.

Sugoi na 05-05-2009 04:28 PM

Suggestion #2

Adding a basic mission / task system

This would add a feature much like your already added "Invest Work Force to Generate Income" feature but more complex & rewarding.

Instead of just pumping stats into defence & waiting for your cycles to gain more gold & in turn adding even MORE defence, this system should allow for a more strategic & exciting system that will get players involved.

If this is possible & could be done, I am willing to start donating to the project.

Each mission or tasks will require a player to have X amount of admin specified items (X amount of soldiers, gold, attack items, defence items, etc).

So an example mission would be:

Title: Rob a bank
Requirements: 50 soldiers & 50 Swords
Required Turns: 50
Reward: 500 Gold

So if the member attempting to do this mission has 49 soldiers it would throw an error stating you do not meet the requirements.

If you were able to reward certain items instead of just gold that would make the system even better! Then an admin can create mission only items!

I mean the ideas for this would be never ending.

You can hide missions until members have X amount of soldiers. You can have missions that award you spies. Like I said, the ideas just keep coming!

It is something that I feel could REALLY give more than just attack a person & log off the forum. It gives depth & pretty much could make this an addicting games.

If anyone has a better idea I won't be offended at all! I hope this is something we could look forward to in the future!


All times are GMT. The time now is 04:56 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01899 seconds
  • Memory Usage 1,916KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete