phpBB Forum

It is currently Wed 23. May 2012, 17:09

All times are UTC + 1 hour

Forum rules


Hello dearest user and welcome to our EQDKP-Plus support forum.

Please read the following rules and terms before posting anything! Failure in doing so will result in being ignored or being banned. Posting in our boards means you have read, understood and accepted those rules.

English Board Rules – Click here



Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10
Author Message
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Fri 5. Jun 2009, 20:57 

Joined: Thu 2. Apr 2009, 23:24
Posts: 13
you have to chane the $decay value in the decay_mysql.php file. People with negative DKP are being awarded dkp insted of being deducted more.

This is what it should be to remove dkp from everyone.
Code:
  if ($current > 0){
    $decay = -($current * $percent / 100);
  }else{
    $decay = -($current * -$percent / 100);




Ive modified the code to take 8-10% of the max weekly dkp. If you have >80% attd for the week you get 8% decay of the weeks earned dkp, >50 then 9% <50 is 10%. This we felt awards people who show up all the time. Plus we had some members where it was getting to the point where we didnt earn enough DKP for the week to cover the decay. IE 2000+ dkp and we would only earn 150-200 per week so those members where it was taking 10% of the total dkp were never getting anywhere and we didnt feel that was right.
Code:
$sql = "SELECT sum(a.attdv) as attdv, a.member_name, a.member_adjustment from (
SELECT
count(*) as attdv,
sum(raid_value) as raidvalue,
eqdkp_members.member_id,
eqdkp_members.member_name,
eqdkp_members.member_earned,
eqdkp_members.member_spent,
eqdkp_members.member_adjustment,
eqdkp_members.member_status,
eqdkp_members.member_firstraid,
eqdkp_members.member_lastraid,
eqdkp_members.member_raidcount,
eqdkp_members.member_level,
eqdkp_members.member_race_id,
eqdkp_members.member_class_id,
eqdkp_members.member_rank_id,
eqdkp_members.member_xml,
eqdkp_raid_attendees.raid_id
FROM
eqdkp_members
Left Join eqdkp_raid_attendees ON eqdkp_members.member_name = eqdkp_raid_attendees.member_name
LEFT Join eqdkp_raids ON eqdkp_raid_attendees.raid_id = eqdkp_raids.raid_id
WHERE eqdkp_raids.raid_date BETWEEN unix_timestamp( DATE_SUB(now(), INTERVAL 7 DAY)) AND unix_timestamp(now())
GROUP BY eqdkp_members.member_name
UNION
SELECT
0 as attdv,
0 as raidvalue,
eqdkp_members.member_id,
eqdkp_members.member_name,
eqdkp_members.member_earned,
eqdkp_members.member_spent,
eqdkp_members.member_adjustment,
eqdkp_members.member_status,
eqdkp_members.member_firstraid,
eqdkp_members.member_lastraid,
eqdkp_members.member_raidcount,
eqdkp_members.member_level,
eqdkp_members.member_race_id,
eqdkp_members.member_class_id,
eqdkp_members.member_rank_id,
eqdkp_members.member_xml,
eqdkp_raid_attendees.raid_id
FROM
eqdkp_members
Left Join eqdkp_raid_attendees ON eqdkp_members.member_name = eqdkp_raid_attendees.member_name
LEFT Join eqdkp_raids ON eqdkp_raid_attendees.raid_id = eqdkp_raids.raid_id
GROUP BY eqdkp_members.member_name
)a
GROUP BY a.member_name
";
$member_fetch = mysql_query( $sql );
$maxraids ="SELECT count(*) as ttl,sum(raid_value) as raidvalue FROM  eqdkp_raids r WHERE r.raid_date BETWEEN unix_timestamp( DATE_SUB(now(), INTERVAL 7 DAY)) AND unix_timestamp(now())";
$maxraids_fetch = mysql_query( $maxraids );
$weekdkp = mysql_fetch_array($maxraids_fetch);
$max = $weekdkp['raidvalue'];
$raids =$weekdkp['ttl'];
while ($decay_members = mysql_fetch_array( $member_fetch, MYSQL_ASSOC)){   
  $atdv=($decay_members['attdv']/$raids)*100;
if ($atdv < 50)
{$decay = $max*.10;}
else if ($atdv < 80)
{$decay = $max*.09;}
else
{$decay = $max*.08;}
$decay=$decay*-1;
echo $decay_members['member_name']." : ".$decay."<br/>";



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Fri 7. Aug 2009, 15:32 

Joined: Fri 7. Aug 2009, 15:30
Posts: 1
Has anyone got this that will work for multi dkp?
All I need is a plugin, or script to take off 50% off 10 man dkp and 25 man dkp.
At the moment I do this manually once a month and it takes ages.

Can anyone help please?



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Thu 12. Nov 2009, 14:07 

Joined: Thu 12. Nov 2009, 13:38
Posts: 6
Location: France/Paris
Hi all!

for my first post, i'll be a little bit talkative ;)

i spent the last two weeks busy setting up the new site for our guild.
i am especially looking how to implement eqdkp and solving a few issues we had with the standard features, one of which is decay for multidkp.

so i went through understanding the data model, the framework (php, scripting, mysql, plugins, etc.). btw i was not helped by the example provided (hello world plugin) because it
was not working :oops:

next steps is implementing our second feature: bonus dkp for members for those who put their attendance on raidplanner :mrgreen:

to come back to multidkp this thread was most useful so i decided to share what i did.
here is the main piece of my code for multidkp decay; it is not yet cleaned up but it is working (x% off if attendance less than 50% on the last month raids). The main idea for multidkp is to use the eqdkp class "dkpplus".

hope it will help some of you guys !

Code:
<?php
 /*
  * Decay aadkp
  * Mortal@Voljin
 */

// EQdkp required files/vars
define('EQDKP_INC', true);
define('IN_ADMIN', true);
define('PLUGIN', 'aadkp');
$eqdkp_root_path = './../../../';
include_once ('../includes/common.php');

// Check if plugin is installed
if (!$pm->check(PLUGIN_INSTALLED, 'aadkp')) { message_die('The aadkp plugin is not installed.'); }

// Check user permission
$user->check_auth('a_aadkp');

// Get the plugin
$aadkp = $pm->get_plugin('aadkp');

//---------
global $table_prefix;
global $db, $eqdkp, $user, $tpl, $pm;
global $SID;

function gen_group_key($part1, $part2, $part3)
{
    // Normalize data
    $part1 = htmlspecialchars(stripslashes($part1));
    $part2 = htmlspecialchars(stripslashes($part2));
    $part3 = htmlspecialchars(stripslashes($part3));

    // Get the first 10-11 digits of each md5 hash
    $part1 = substr(md5($part1), 0, 10);
    $part2 = substr(md5($part2), 0, 11);
    $part3 = substr(md5($part3), 0, 11);

    // Group the hashes together and create a new hash based on uniqid()
    $group_key = $part1 . $part2 . $part3;
    $group_key = md5(uniqid($group_key));

    return $group_key;
}

// Process submit
if ($_POST['percent'] and $_POST['account']){
   $percent = $_POST['percent'];
   $account = $_POST['account'];
   $account_id= substr($account,0,stripos($account,":"));
   $account_name= substr($account,stripos($account,":")+1);
    $info = "processing id=".$account."/".$account_id."(".$account_name.") with ".$percent."% decay\n";

   // Calcul du nombre de raids sur le dernier mois
   $start_date=mktime(0, 0, 0, date('m'), date('d')-30, date('Y'));
   $end_date= time();
   $raids_count = $db->query_first( "SELECT count(DISTINCT FROM_UNIXTIME(raid_date,'%y%m%d')) as raid_c FROM eqdkp_raids, eqdkp_multidkp2event WHERE (raid_date BETWEEN " . $start_date . " AND " . $end_date . ") AND multidkp2event_eventname = raid_name AND multidkp2event_multi_id=".$account_id );
   $info = $info. "nb de raids:".$raids_count."\n";

   // tableau des membres
   $sql = "SELECT * FROM eqdkp_members m";
   if ( !($result = mysql_query($sql)) ) {
      message_die('Could not obtain member DKP information', '', __FILE__, __LINE__, $sql);
      }

   while ($row = $db->fetch_record($result)) # member row
      {
      // participation
      $raid_count = $db->query_first( "SELECT count(DISTINCT FROM_UNIXTIME(r.raid_date,'%y%m%d')) as raid_c FROM eqdkp_raids r, eqdkp_multidkp2event, eqdkp_raid_attendees ra WHERE (r.raid_date BETWEEN " . $start_date . " AND " . $end_date . ") AND multidkp2event_eventname = r.raid_name AND multidkp2event_multi_id=".$account_id." AND ra.raid_id=r.raid_id AND ra.member_name='".$row['member_name']."'"); // or message_die(mysql_error());
      $percent_of_raids = ( $raids_count > 0 ) ? round(($raid_count / $raids_count) * 100) : 100;
//      $info=$info. $row['member_name'] . ":" . $percent_of_raids ."%" ;
      // get multidkp
      $member_multidkp = $dkpplus-> multiDkpMemberArray($row['member_name']) ; // create the multiDKP Table
   
      if(!empty($member_multidkp[$row['member_name']]))
         {
         foreach ($member_multidkp[$row['member_name']] as $key)  # Compte dkp
            {
            if ( $key['name'] == $account_name) {
               $current=$key['current'];
               $adjust=$key['adjust'];
//               $info = $info."DKP:".$current."/adjust:".$adjust."\n";
            }
         }
      }
      // decay
      if ($current > 0){
          $decay = -($current * $percent / 100);
      }else{
         $decay = 0;
        }
       if ($percent_of_raids<50 and $decay<0) {
      // ajustement
      $adjustment_reason = "Depreciation de " . $percent . "% (participation de " .$percent_of_raids."%)";
      $info = $info . $row['member_name'] . ":" . $adjustment_reason .":DKP avant=".$current."; decay=".$decay.":".$user->data['username']."\n";
      $group_key = gen_group_key($time, stripslashes($adjustment_reason), $decay, $event);
      
      $sql = "INSERT INTO eqdkp_adjustments (adjustment_value, adjustment_date, member_name, adjustment_reason, adjustment_added_by, adjustment_updated_by, adjustment_group_key, raid_name) VALUES (".$decay.", $end_date, '".$row['member_name']."', '$adjustment_reason', '".$user->data['username']."', NULL, '$group_key' , '$account_name')";
//      $info = $info . $sql ."\n";
      mysql_query ($sql);
      $newadjust = $adjust + $decay;
      $sql = "UPDATE eqdkp_members set member_adjustment = '$newadjust' WHERE member_name = '".$row['member_name']."'";
//      $info = $info . $sql ."\n";
      mysql_query ($sql);
      }

   } // end fetch

} //end submit

// comptes dkp
$sql = "SELECT * FROM " . $table_prefix . "multidkp";
   if (!($settings_result = $db->query($sql))) { message_die('Pas de comptes dkp', '', __FILE__, __LINE__, $sql); }

   while($roww = $db->fetch_record($settings_result)) {
        $opt1 = $roww['multidkp_id'];
        $opt2 = $roww['multidkp_name'];
      $opt = $opt."<option value='".$opt1.":".$opt2."'>".$opt2."</option>";
   }


//------------------------
//
// Populate the fields
//
$tpl->assign_vars(array(
      // Form vars
      'F_CONFIG'              => 'admindecay.php' . $SID,
     
      // Form values
     'MESSAGE'  => (isset($info) && $info!=1) ? stripmultslashes($info) : "",
      'OPTIONS'  =>   isset($opt) ? $opt : "",

      // Language
      'L_SUBMIT'              => $user->lang['submit'],
      'L_GENERAL'             => "Dépreciation mensuelle",
      )
      );
   
    $eqdkp->set_vars(array(
      'page_title'             => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': Dépréciation mensuelle',
      'template_path'           => $pm->get_data('aadkp', 'template_path'),
      'template_file'          => 'admin/decay.html',
      'display'                => true)
    );
   

?>



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Sat 12. Dec 2009, 12:02 

Joined: Thu 12. Nov 2009, 13:38
Posts: 6
Location: France/Paris
hi !

following your request, i enclose the full plugin version. it is not a clean version (language pack incomplete, and you may find some french in the text :s , and the html files are only included for the wow9wlk lool&feel ) but it should be easy for you to modify.

there is also a "simulate" checkbox to avoid updating the database that allows you to check the result beforehand 8-)

i did not add the other specific features done for my guild (bonus dkp for those who did register on raid calendar on time, stats, etc.) but i did leave the template framework (admincoucou) if you want to add your own functions.

++
Mortal


Attachments:
aadkp.zip [18.65 KiB]
Downloaded 141 times

Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Sat 19. Dec 2009, 09:48 

Joined: Mon 16. Mar 2009, 17:01
Posts: 31
Quote:
INSERT INTO eqdkp_adjustments (adjustment_value, adjustment_date, member_name, adjustment_reason, adjustment_added_by, adjustment_updated_by, adjustment_group_key, raid_name) VALUES (-11,1, 1261212181, 'Artem', 'DKP-Tax 10%', 'Yasharah', NULL, '6bd0b57971f1b137530c501b9a8eb610' , 'PdK') failed:Column count doesn't match value count at row 1


the plugin doesn't like me :/


EQDKP: pursuit-wow.de
Version: 0.6.3.5 Stable
Template: Luna
MySQL: 5.0.67
PHP: 5.2.11
fopen: fopen gefunden.



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Tue 29. Dec 2009, 00:01 

Joined: Mon 28. Dec 2009, 01:31
Posts: 7
Tirdal wrote:
I've taken your script, Thundaballs, and made what I hope is a decent plugin out of it.

Probably has some problems like assuming that the database prefix is eqdkp_, but it does seem to work for me. It does not support multi-dkp pools. I changed all references to "tax" or "taxes" to say "decay" so that my guildies never see that horrible "tax" word. :roll:

It reads the database name, user, password, etc. from the main EQDKP config.php file, so you don't need to edit delay_config.php (and in fact that file should probably be removed now that I think about it, but meh).

I'm sure there are problems with it, but it works for me! :D


This works for me. Though is there a way to not give people with a negative amount of DKP, any DKP?
As in... those with negative DKP will not be affected by the decay!

Nvm :p, just changed:
Code:
  $current = $earned - $spend + $adjust['value'];
  if ($current > 0){
    $decay = -($current * $percent / 100);
  }else{
    $decay = +($current * -$percent / 100);
  }

To:
Code:
  if ($current > 0){
    $decay = -($current * $percent / 100);
  }else{
    $decay = 0;
  }



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Mon 15. Feb 2010, 20:08 

Joined: Mon 15. Feb 2010, 20:04
Posts: 1
Hi

My guild used to use webdkp and we moved onto eqdkp plus. When we moved over we added each members dkp as a positive in the adjustment column.

We want to run a decay system on this. WI installed the decay plugin. When i use it it does not seem to want to deduct any reduction for the ones that have a positive adjustment figure.

Or am i doing something wrong.



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Mon 24. Jan 2011, 00:18 
User avatar

Joined: Wed 19. May 2010, 13:10
Posts: 9
This doesn't seem to work with the current version 0.6.4.5 ... any know what is going wrong ?
Something i would like to know aswell ... if this would work with MultiDKP.

Sorry for bringing up an old topic, but this is exactly what we are looking for.

[EDIT]Got it working, just needed some edits for sql prefix and such.[/EDIT]


Image



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Tue 26. Apr 2011, 20:51 

Joined: Mon 4. May 2009, 17:50
Posts: 20
I read through all 10 pages and downloaded/installed the decay plugin however it doesnt seem to do what we need. All I am looking to do is have a simple flat decay system. For every 30 days of inactivity, a person's total DKP pool is reduced by X%?

Any ideas on how I accomplish this?

Thanks
Mashie


EQdkp-Plus Version: 0.6.4.0
PHP Version: 5.2.4
EQdkp-Plus Link: www.heymoe.com
Webspace hoster: 5dollarhosting.com
Default Game: EQ2



Top
 Profile  
 
Offline
 Post subject: Re: Need decay system, could do it myself, but...
PostPosted: Fri 30. Mar 2012, 19:46 

Joined: Wed 9. Nov 2011, 04:47
Posts: 16
Is there a DKP decay method where I can remove ALL DKP earned and spent beyond 60 days of the current day? Basically, I just want the current DKP posted to be only the earned and spent DKP from the last 60 days, not all DKP ever earned and spent.


Our EQDKP+ Address: http://steel.pwninternetgaming.com/eqdkp
EQDKP+ Version: 0.6.4.11
PHP Version: 5.2.17
mySQL Version: 5.0.67-community
PHPInfo: unknown



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

(C) The EQdkp-Plus Developer Team
EQdkp Plus Template by Ramon Kaes