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?


All times are GMT. The time now is 09:19 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.01581 seconds
  • Memory Usage 1,788KB
  • 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_php_printable
  • (4)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