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)

Sayid 07-03-2009 06:07 PM

Quote:

Health first, money second and other mods third.
I like this post :d

Dutch_Boy 07-05-2009 08:13 AM

I got a problem with Conquest System. Normaly you get after 1 hour 1 turn etc, but after 8 hours i only got 4 turns :( Does someone know about this problem and how to fix it?

moat 07-06-2009 01:32 AM

Had that same issue. Our forum is mostly local so its doesn't get any hits overnight. The way VB's scheduling works if noone's hit the site for a few hours the next person only triggers one update and doesn't catchup on the missed ones. I made a few changes to the update script to calculate the number of missed updates and perform a catchup of the missed ones (just wrapped the existing code in a loop)

My conquestCycle.php below. I've changed the update time to 30 mins (the figure of 1800 in 2 lines below) and changed the VB scheduler to 15 minutes. A bit rough but it worked.

PHP Code:

<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!
is_object($vbulletin->db))
{
    exit;
}

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

$settings $vbulletin->db->query_first("SELECT * FROM ".TABLE_PREFIX."conquest_gameset");

$time time();
// $next = $settings[gLastCycle] + (60 * $settings[gCycleMinutes]);
$loopz = (time()-$settings[gLastCycle]) / 1800;
$roundednext time() - (time() % 1800);

// if ($time >= $next)
for($i=1;$i<=$loopz;$i++)
{
    
$vbulletin->db->query_write("UPDATE IGNORE ".TABLE_PREFIX."conquest_gameset SET gLastCycle = '".$roundednext."'");

    
$players $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."conquest_players AS conquest_players
        LEFT JOIN "
.TABLE_PREFIX."conquest_nations AS conquest_nations ON conquest_players.nationID = conquest_nations.nationID
    "
);

    while (
$player $vbulletin->db->fetch_array($players))
    {
        
$spyCost $player[pSpies] * $settings[gSpyUpkeep];
        
$goldGain ceil($settings[gCycleGold] * ($player[nIncome]/100)) - $spyCost;

        
$newTurns $player[pTurns] + $settings[gCycleTurns];
        
$newGold $player[pGold] + $goldGain;
        
$newTroops $player[pTroops] + $settings[gCycleTroops];

        if (
$newTroops $settings[gMinTroops]) { $newTroops $settings[gMinTroops]; }
        if (
$newTurns $settings[gMaxTurns]) { $newTurns $settings[gMaxTurns]; }

        
$vbulletin->db->query_write("
            UPDATE IGNORE "
.TABLE_PREFIX."conquest_players
            SET    pTurns = "
.$newTurns.",
                pGold = "
.$newGold.",
                pTroops = "
.$newTroops."
            WHERE playerID = "
.$player[playerID]."
        "
);
    }
}

?>


Xencored 07-06-2009 12:30 PM

Jaxel is there any way i can add the (Turns and gold) to just "Private Messages: Unread 0, Total 55" in the navbar bit so people can see when they get turns etc..

this gets used so much on my forum lol
Thanks for this great mod ;)

Dutch_Boy 07-06-2009 07:47 PM

Quote:

Originally Posted by moat (Post 1843539)
Had that same issue. Our forum is mostly local so its doesn't get any hits overnight. The way VB's scheduling works if noone's hit the site for a few hours the next person only triggers one update and doesn't catchup on the missed ones. I made a few changes to the update script to calculate the number of missed updates and perform a catchup of the missed ones (just wrapped the existing code in a loop)

My conquestCycle.php below. I've changed the update time to 30 mins (the figure of 1800 in 2 lines below) and changed the VB scheduler to 15 minutes. A bit rough but it worked.

PHP Code:

<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!
is_object($vbulletin->db))
{
    exit;
}

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

$settings $vbulletin->db->query_first("SELECT * FROM ".TABLE_PREFIX."conquest_gameset");

$time time();
// $next = $settings[gLastCycle] + (60 * $settings[gCycleMinutes]);
$loopz = (time()-$settings[gLastCycle]) / 1800;
$roundednext time() - (time() % 1800);

// if ($time >= $next)
for($i=1;$i<=$loopz;$i++)
{
    
$vbulletin->db->query_write("UPDATE IGNORE ".TABLE_PREFIX."conquest_gameset SET gLastCycle = '".$roundednext."'");

    
$players $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."conquest_players AS conquest_players
        LEFT JOIN "
.TABLE_PREFIX."conquest_nations AS conquest_nations ON conquest_players.nationID = conquest_nations.nationID
    "
);

    while (
$player $vbulletin->db->fetch_array($players))
    {
        
$spyCost $player[pSpies] * $settings[gSpyUpkeep];
        
$goldGain ceil($settings[gCycleGold] * ($player[nIncome]/100)) - $spyCost;

        
$newTurns $player[pTurns] + $settings[gCycleTurns];
        
$newGold $player[pGold] + $goldGain;
        
$newTroops $player[pTroops] + $settings[gCycleTroops];

        if (
$newTroops $settings[gMinTroops]) { $newTroops $settings[gMinTroops]; }
        if (
$newTurns $settings[gMaxTurns]) { $newTurns $settings[gMaxTurns]; }

        
$vbulletin->db->query_write("
            UPDATE IGNORE "
.TABLE_PREFIX."conquest_players
            SET    pTurns = "
.$newTurns.",
                pGold = "
.$newGold.",
                pTroops = "
.$newTroops."
            WHERE playerID = "
.$player[playerID]."
        "
);
    }
}

?>


Where do i need to put this code?

ged 07-07-2009 04:05 AM

Quote:

Originally Posted by Dutch_Boy (Post 1844027)
Where do i need to put this code?

Quote:

Originally Posted by moat (Post 1843539)
My conquestCycle.php

There it is.

moat 07-07-2009 04:07 AM

conquestCycle.php is in {forum}/includes/cron

therogueforums 07-07-2009 11:19 AM

Can anyone please tell me how to change a player's nation? One nation has grown extremely powerful, as everyone is joining that one, and I'd like to even the odds, and switch teams.

EDIT: Nevermind. I found the SQL is pretty easily to manipulate.

Tagert 07-08-2009 11:01 AM

I like this mod! I look forward to the updates !
Keep it up !

amish_irish 07-13-2009 12:06 AM

I am thinking about bringing this into my site but my users will not be excited about the ..um.... fantasy aspect of it, it is a sports forum. So I was thinking about changing some of the terms and changing the three nation graphics. The latter is easy enough to do. What I am worried about is that I will be screwed when I go to update the product. Do you think this will be an issue? Is there a safe way for me to change it?

ged 07-13-2009 05:28 AM

Nobody knows about forward updates ATM.

therogueforums 07-13-2009 09:47 AM

Anyone willing to take a stab at the whole resources, and being able to trade them? Or nation heroes?

BlueNinjaGo 07-13-2009 03:23 PM

Quote:

Originally Posted by amish_irish (Post 1847778)
I am thinking about bringing this into my site but my users will not be excited about the ..um.... fantasy aspect of it, it is a sports forum. So I was thinking about changing some of the terms and changing the three nation graphics. The latter is easy enough to do. What I am worried about is that I will be screwed when I go to update the product. Do you think this will be an issue? Is there a safe way for me to change it?

It's not too hard to change... some of it is changed through the product... some of it can be changed in phrases and templates, and some of it can be changed in the code. I'm not sure if it's fully phased or not.

Tagert 07-13-2009 04:39 PM

Quote:

Originally Posted by amish_irish (Post 1847778)
I am thinking about bringing this into my site but my users will not be excited about the ..um.... fantasy aspect of it, it is a sports forum. So I was thinking about changing some of the terms and changing the three nation graphics. The latter is easy enough to do. What I am worried about is that I will be screwed when I go to update the product. Do you think this will be an issue? Is there a safe way for me to change it?

well you could change the nation names to something sport'ish I guess, and the weapon names to different powerful tennis rackets to smash the other ones with haha :P

amish_irish 07-14-2009 01:21 AM

Well it is a football board so it shouldn't be too tough of a stretch.

Hornstar 07-18-2009 12:36 AM

I just got this error after it has been working fine too: Fatal error: Allowed memory size of 131072000 bytes exhausted (tried to allocate 35 bytes) in /home/***/public_html/forums/conquest/functions_conquest.php on line 62

I applied the fix in this thread and it fixed it.

would be nice to see some updates applied to this game tho.

ged 07-18-2009 05:35 AM

Yes I hope there will be some updates before the end of the month. :)

Tagert 07-18-2009 07:15 PM

Quote:

Originally Posted by ged (Post 1850971)
Yes I hope there will be some updates before the end of the month. :)

I hope so too!
*keeps fingers crossed*
great mod indeed, a favorite on my community forum.

DevilzFan 07-22-2009 01:43 AM

Howdy folks. This looks like an awesome mod.

I'm having an installation issue though. When I go to import the product XML in the admincp, I keep getting the following database error:

Quote:

* ltering Table usergroup ...Done!

* Creating Table ciconquest_armours ... Done!
* Inserting Rows ciconquest_armours ...
Database Error Database error
Site database has encountered a problem.
Please try the following:
o Load the page again by clicking the Refresh button in your web browser.
o Open the home page, then try to open another page.
o Click the Back button to try another link.
The forum technical staff have been notified of the error, though you may contact them if the problem persists.

We apologise for any inconvenience.
Database error in vBulletin 3.8.2: Invalid SQL: INSERT INTO ciconquest_armours (aName, aPower, aCost) VALUES ('Fur Hide', 20, 25), ('Leather', 30, 50), ('Carapice', 50, 100), ('Laminate', 95, 200), ('Iron Plate', 135, 300), ('Bronzed', 170, 400), ('Rolled Steel', 200, 500); MySQL Error : Duplicate entry 'Fur Hide' for key 2 Error Number : 1062 Request Date : Tuesday, July 21st 2009 @ 10:35:34 PM Error Date : Tuesday, July 21st 2009 @ 10:35:34 PM Script : http://www.XXXXXXXXXXX.com/forums/ad...=productimport Referrer : http://www.XXXXXXXXXX.com/forums/adm...?do=productadd IP Address : 67.84.82.71 Username : J.D. Classname : vB_Database MySQL Version : 4.0.27-max-log



Database error in vBulletin 3.8.2:

Invalid SQL:
INSERT INTO ciconquest_armours (aName, aPower, aCost) VALUES
('Fur Hide', 20, 25),
('Leather', 30, 50),
('Carapice', 50, 100),
('Laminate', 95, 200),
('Iron Plate', 135, 300),
('Bronzed', 170, 400),
('Rolled Steel', 200, 500);

MySQL Error : Duplicate entry 'Fur Hide' for key 2
Error Number : 1062
Request Date : Tuesday, July 21st 2009 @ 10:35:34 PM
Error Date : Tuesday, July 21st 2009 @ 10:35:34 PM
Script : http://www.XXXXXXXXX.com/forums/admi...=productimport
Referrer : http://www.XXXXXXXXXXXX.com/forums/a...?do=productadd
IP Address : XXXXXXXXXX
Username : J.D.
Classname : vB_Database
MySQL Version : 4.0.27-max-log
Any ideas?

ragtek 07-22-2009 03:56 AM

Quote:

Originally Posted by Collussus (Post 1812100)
1

If anyone is using kbank on their forum too, i made an item for the shop to give turns when you buy it ;)

would you share it with us?*g*

Dutch_Boy 07-22-2009 11:28 AM

Fingers crossed. I hope jaxel bring out a new update as soon as possible.

Jaxel is it prossible to add something so you can turn the PM's off that you get if someone attacks you. My members complain about the PM's.

Jaxel 07-22-2009 01:42 PM

Dutch... I dont have as much time to program as I used to... so things take a bit longer now...

But know that I DO read every comment people post and I will be taking people's suggestions for the next version.

ArchangelX 07-23-2009 03:04 AM

Nice to hear Jaxel...our conquest system has pretty much gone off the deep end as noone plays it any longer because it's got so many needed functions. The balancing is difficult...thanks for the hard work.

Dutch_Boy 07-23-2009 10:03 AM

Quote:

Originally Posted by Jaxel (Post 1853539)
Dutch... I dont have as much time to program as I used to... so things take a bit longer now...

But know that I DO read every comment people post and I will be taking people's suggestions for the next version.

Cant someone help you? Do some things that are really needed and the rest can you do later on.

So the great mod doesnt die.

New Joe 07-25-2009 02:30 PM

I don't understand this part of the installation instructions;
Quote:

CHMOD /conquest/nations to 777.

Stifmeister2 07-25-2009 05:43 PM

Quote:

Originally Posted by New Joe (Post 1855199)
I don't understand this part of the installation instructions;

Use your ftp program (the one you use to upload files to your server) for this.

In most FTP programs all you need to do is to right click "nations" folder and give every group all the permissions.

Here's one example how it looks in some program:
http://www.ecardmax.com/templates/Ma...d-777_cute.gif

Dribbles 07-25-2009 09:58 PM

Any way to make the battles more exciting? Right now it's just a line of text that says whether u woin or not

Megatr0n 07-26-2009 10:16 AM

Jaxel, any idea when we can expect the new version?

therogueforums 07-26-2009 11:39 AM

I'd like to know, too.

Dutch_Boy 07-26-2009 02:06 PM

Quote:

Originally Posted by Jaxel (Post 1853539)
Dutch... I dont have as much time to program as I used to... so things take a bit longer now...

But know that I DO read every comment people post and I will be taking people's suggestions for the next version.

Read his post before you ask stupid questions ;) :P

Give him the time to bring out a kick ass update :)

therogueforums 07-26-2009 06:41 PM

Quote:

Originally Posted by Dutch_Boy (Post 1855876)
Read his post before you ask stupid questions ;) :P

Give him the time to bring out a kick ass update :)

Excuse me? Read his post, before you make stupid remarks. ;)

He was asking on a possible time frame on when we could expect the updates. We all know Jaxel is mega busy with other projects, but it doesn't mean he can't give us a ballpark figure of when he might be able to update this mod.

yotsume 07-27-2009 07:05 AM

The fact that the demo site shows a database error message is not good for me so Ill just tag this as a maybe for the future...

Thesdale 08-01-2009 01:35 AM

Awesome mod! We use it at http://www.weplayciv.com and it's very popular with our players.

However there is a SEVERE error in how the AR and DR are calculated. Using the supplied formulas the effect of a promotion affects every unit in the army, not a single unit. Also to note in the original formula, natural attack/defense bonus of the Civ is not calculated unless the player has a promotion (multiply by zero issue). Thus the most efficient use of converting gold to AR/DR is to purchase level 1 or 2 promotions. Forget upgrades as the bonus is massively less than spending the equivalent on promotions. Like I'm talking many thousands of AR/DR points.

So with that in mind I've created new formulas to calculate both ratings correctly, where a promotion is only applied to a single unit and upgrades affect the entire army. This has fixed all the inbalance for us. :)

The below code replaces the same functions in functions_conquest.php in your Conquest folder in the forums.

Code:

function fetch_offense($player)
{
        global $vbulletin;

        $weapons = $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."conquest_stock AS conquest_stock
                LEFT JOIN ".TABLE_PREFIX."conquest_weapons AS conquest_weapons ON conquest_stock.stockID = conquest_weapons.weaponID
                WHERE conquest_stock.playerID = ".$player[playerID]." AND conquest_stock.stockType = 'weapon'
                ORDER BY conquest_weapons.wPower DESC
        ");
        $count = array();

        while ($weapon = $vbulletin->db->fetch_array($weapons))
        {
                for ($i = 0; $i < $weapon[stockCount]; $i++)
                {
                        array_push($count, ($player[oPower] * ($weapon[wPower] / 100)));
                }
        }

        $power = 1 + ((array_sum(array_slice($count, 0, $player[pTroops])) + ($player[pTroops] * $player[oPower])) * ((100 + $player[nOffense]) / 100));

        return $power;
}

function fetch_defense($player)
{
        global $vbulletin;

        $armours = $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."conquest_stock AS conquest_stock
                LEFT JOIN ".TABLE_PREFIX."conquest_armours AS conquest_armours ON conquest_stock.stockID = conquest_armours.armourID
                WHERE conquest_stock.playerID = ".$player[playerID]." AND conquest_stock.stockType = 'armour'
                ORDER BY conquest_armours.aPower DESC
        ");
        $count = array();

        while ($armour = $vbulletin->db->fetch_array($armours))
        {
                for ($i = 0; $i < $armour[stockCount]; $i++)
                {
                        array_push($count, ($player[dPower] * ($armour[aPower] / 100)));
                }
        }

        $power = 1 + ((array_sum(array_slice($count, 0, $player[pTroops])) + ($player[pTroops] * $player[dPower])) * ((100 + $player[nDefense]) / 100));

        return $power;
}


Thesdale 08-01-2009 11:24 PM

Another thing we found in our previous game is that 90% of players gravitated to 3 out of 10 nations. This caused a huge inbalance in player numbers leaving most nations with a couple of players and prime targets against the bigger nations.

So I implemented the following if .... else .... then statement around the join nation button to help spread players across all nations. Basically, if the player percentage of that nation is lower than a set threshold then the join button is active, otherwise you get a message saying recruitment disabled for that nation. For us I used 20% of all players in the game as the threshold, but you can change it to whatever works for the number of nations you have. For example, with 3 nations you would probably want to set this threshold to 50%, so no nation has more than half the total players.

In style manager open conquest_enlist_bit and find the form submission for joining a nation. Replace it with this:

Code:

                        <if condition="$nation[AVGplayerID] < 20">
                                <form action="$filename?do=homebase" method="post">
                                <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                                <input type="hidden" name="joinrequest" value="$nation[nationID]" />
                                <input type="submit" value="<phrase 1="$nation[nName]">$vbphrase[conquest_enlist_join]</phrase>" />
                                </form>
                        <else />
                                Recruitment disabled. Join other Civ.
                        </if>


xoclanes 08-02-2009 04:10 AM

usergroup permissions dont work to me, when I setup it always its resets to "no" again :S and creates another admintrator usergroup in each try... :S:S

Hornstar 08-02-2009 06:30 AM

@ Thesdale, thanks for your code. I would love to see some of those implemented in the next update as I think they are great. Thanks.

PAKIDIL 08-02-2009 07:09 AM

allowing chmd 777 to the directory dont you think its risky in term of hacking the forum ?

blogthea 08-02-2009 05:57 PM

can't wait for the new version! Keep up the good work

Hornstar 08-02-2009 09:53 PM

Search did not come up with anything, but has anyone had any issues with users having 4 billion gold after about 10 minutes of them using this?

xoclanes 08-02-2009 09:56 PM

Quote:

Originally Posted by xoclanes (Post 1859944)
usergroup permissions dont work to me, when I setup it always its resets to "no" again :S and creates another admintrator usergroup in each try... :S:S

any clue about this issue? :(


All times are GMT. The time now is 09:20 PM.

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.01940 seconds
  • Memory Usage 1,899KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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