[12-05]forpw4.x 论坛奖罚系统
=======================================
插件名称:论坛随机奖罚系统 1.1
=======================================
适用版本:phpwind 3.0.1 pw4.x
完成时间:2005.11.3 并于12.4 完善
HACK: 快乐天使
大家可以访问http://pet.dreahome.com/观看演示效果,有任何问题均可在论坛提出!!!!
**********************************
安装方法:
**********************************
一、上传压缩包中除《安装说明》外其它文件到论坛的对应目录
记得把data/bbscache/pet.php的属性改为可写。
二、修改require/postnew.php文件:
找到:
Code:
$atc_iconid=(int)$atc_iconid;
[Ctrl+A Select All]
在这一句下面添加下面代码:
Code:
//论坛和宠物随机奖励系统
include_once(R_P.'data/bbscache/pet.php');
if(rand(1,1000) < $petset[diaobaolv] && strlen($atc_content) > $petset[wzhchdu])
{
$mypet = $db->get_one("SELECT mypet FROM cdb_mypetdata WHERE username='$windid'");
if(!$mypet)
{
if(rand(1,10)>5)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]+=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>哈哈,运气来了挡也挡不住,天上掉下<font color=red size=4>$dd</font>个金钱砸在你头上!<br></font></fieldset></div>";
}
elseif(rand(1,5)>4)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=gray size=1>嘎嘎,霉气来了喝开水也塞牙!违章发贴被罚款<font color=red size=4>$dd</font>个金钱!<br></font></fieldset></div>";
}
else
{
if(!$petset[creat])
{$itemshow="<div align=center><fieldset style=width=70%><font color=blue size=1>竹篮打水--白发一贴!哈哈<br></font></fieldset></div>";}
else
{
$dd=rand($petset[creat]*0.5,$petset[creat]*1.5);
$winddb[rvrc]+=$dd*10;
$itemshow="<div align=center><fieldset style=width=70%><font color=lightgreen size=1>天上掉甘露,你幸运舔到了<font color=red size=4>$dd</font>颗!好甜啊!<br></font></fieldset></div>";
}
}
}
else
{
if(rand(1,10)>5)
{
$idsrand=rand(1,1000);
if($idsrand>0 && $idsrand<=200){$id =rand(1,3);}
elseif($idsrand>200 && $idsrand<=400){$id =rand(9,13);}
elseif($idsrand>400 && $idsrand<=550){$id =rand(17,20);}
elseif($idsrand>550 && $idsrand<=730){$id =rand(40,44);}
elseif($idsrand>730 && $idsrand<=780){$id =rand(5,8);}
elseif($idsrand>780 && $idsrand<=830){$id =rand(14,16);}
elseif($idsrand>830 && $idsrand<=880){$id =rand(21,23);}
elseif($idsrand>880 && $idsrand<=930){$id =rand(45,48);}
elseif($idsrand>930 && $idsrand<=960){$id =rand(49,52);}
elseif($idsrand>960 && $idsrand<=980){$id =rand(30,34);}
elseif($idsrand>980 && $idsrand<=999){$id =rand(54,57);}
elseif($idsrand>999){$id =rand(54,59);}
$member = $db->get_one("SELECT * FROM cdb_dropitem WHERE id='$id'");
$itemname=$member[itemname];
$cname=$member[cname];
$query = $db->query("UPDATE cdb_mypetdata SET $itemname=$itemname+1 WHERE username='$windid'");
$itemshow="<div align=center><fieldset style=width=70%><font color=lightgreen size=1>轰的一声巨响,天上掉下神仙水一滴,化作一个<font color=red size=4>$cname</font>,恭喜!恭喜啊!<br></font></fieldset></div>";
}
else
{
if(rand(1,5)>2)
{
$dd = rand($petset[diaocwb]*0.5,$petset[diaocwb]*1.5);
$query = $db->query("UPDATE cdb_mypetdata SET agibow=agibow+$dd WHERE username='$windid'");
$itemshow="<div align=center><fieldset style=width=70%><font color=blue size=1>看你很辛苦,你的宠物宝宝为你打工赚了<font color=red size=4>$dd</font>个宠物币!<br></font></fieldset></div>";
}
elseif(rand(1,5)>2)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]+=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>为表彰你为论坛作出的突出贡献,奖你<font color=red size=4>$dd</font>个论坛币<br></font></fieldset></div>";
}
elseif(rand(1,5)>3)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>出门在外不小心丢了<font color=red size=4>$dd</font>个论坛币<br></font></fieldset></div>";
}
else
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>你为论坛的发展捐赠<font color=red size=4>$dd</font>个论坛币<br></font></fieldset></div>";
}
}
}
}
elseif(rand(1,5)>2 && strlen($atc_content)<10)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=green size=1>你为天使宠物开发捐赠<font color=red size=4>$dd</font>个金币<br></font></fieldset></div>";
}
else
{
$itemshow="";
}
$atc_content=$itemshow.$atc_content;
//宠物随机奖励系统
[Ctrl+A Select All]
三、(如果需要在回复中也实现论坛和宠物随机奖励效果请进行这一步,否则可以不修改)
修改require/postreply.php文件:
找到:
Code:
$atc_content=trim($atc_content);
[Ctrl+A Select All]
在这一句下面添加下面代码:
Code:
//论坛和宠物随机奖励系统
include_once(R_P.'data/bbscache/pet.php');
if(rand(1,1000) < $petset[diaobaolv] && strlen($atc_content) > $petset[wzhchdu])
{
$mypet = $db->get_one("SELECT mypet FROM cdb_mypetdata WHERE username='$windid'");
if(!$mypet)
{
if(rand(1,10)>5)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]+=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>哈哈,运气来了挡也挡不住,天上掉下<font color=red size=4>$dd</font>个金钱砸在你头上!<br></font></fieldset></div>";
}
elseif(rand(1,5)>4)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=gray size=1>嘎嘎,霉气来了喝开水也塞牙!违章发贴被罚款<font color=red size=4>$dd</font>个金钱!<br></font></fieldset></div>";
}
else
{
if(!$petset[creat])
{$itemshow="<div align=center><fieldset style=width=70%><font color=blue size=1>竹篮打水--白发一贴!哈哈<br></font></fieldset></div>";}
else
{
$dd=rand($petset[creat]*0.5,$petset[creat]*1.5);
$winddb[rvrc]+=$dd*10;
$itemshow="<div align=center><fieldset style=width=70%><font color=lightgreen size=1>天上掉甘露,你幸运舔到了<font color=red size=4>$dd</font>颗!好甜啊!<br></font></fieldset></div>";
}
}
}
else
{
if(rand(1,10)>5)
{
$idsrand=rand(1,1000);
if($idsrand>0 && $idsrand<=200){$id =rand(1,3);}
elseif($idsrand>200 && $idsrand<=400){$id =rand(9,13);}
elseif($idsrand>400 && $idsrand<=550){$id =rand(17,20);}
elseif($idsrand>550 && $idsrand<=730){$id =rand(40,44);}
elseif($idsrand>730 && $idsrand<=780){$id =rand(5,8);}
elseif($idsrand>780 && $idsrand<=830){$id =rand(14,16);}
elseif($idsrand>830 && $idsrand<=880){$id =rand(21,23);}
elseif($idsrand>880 && $idsrand<=930){$id =rand(45,48);}
elseif($idsrand>930 && $idsrand<=960){$id =rand(49,52);}
elseif($idsrand>960 && $idsrand<=980){$id =rand(30,34);}
elseif($idsrand>980 && $idsrand<=999){$id =rand(54,57);}
elseif($idsrand>999){$id =rand(54,59);}
$member = $db->get_one("SELECT * FROM cdb_dropitem WHERE id='$id'");
$itemname=$member[itemname];
$cname=$member[cname];
$query = $db->query("UPDATE cdb_mypetdata SET $itemname=$itemname+1 WHERE username='$windid'");
$itemshow="<div align=center><fieldset style=width=70%><font color=lightgreen size=1>轰的一声巨响,天上掉下神仙水一滴,化作一个<font color=red size=4>$cname</font>,恭喜!恭喜啊!<br></font></fieldset></div>";
}
else
{
if(rand(1,5)>2)
{
$dd = rand($petset[diaocwb]*0.5,$petset[diaocwb]*1.5);
$query = $db->query("UPDATE cdb_mypetdata SET agibow=agibow+$dd WHERE username='$windid'");
$itemshow="<div align=center><fieldset style=width=70%><font color=blue size=1>看你很辛苦,你的宠物宝宝为你打工赚了<font color=red size=4>$dd</font>个宠物币!<br></font></fieldset></div>";
}
elseif(rand(1,5)>2)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]+=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>为表彰你为论坛作出的突出贡献,奖你<font color=red size=4>$dd</font>个论坛币<br></font></fieldset></div>";
}
elseif(rand(1,5)>3)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>出门在外不小心丢了<font color=red size=4>$dd</font>个论坛币<br></font></fieldset></div>";
}
else
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=deeppink size=1>你为论坛的发展捐赠<font color=red size=4>$dd</font>个论坛币<br></font></fieldset></div>";
}
}
}
}
elseif(rand(1,5)>2 && strlen($atc_content)<10)
{
$dd=rand($petset[diaoltb]*0.5,$petset[diaoltb]*1.5);
$winddb[money]-=$dd;
$itemshow="<div align=center><fieldset style=width=70%><font color=green size=1>你为天使宠物开发捐赠<font color=red size=4>$dd</font>个金币<br></font></fieldset></div>";
}
else
{
$itemshow="";
}
$atc_content=$itemshow.$atc_content;
//宠物随机奖励系统
[Ctrl+A Select All]
四、进入论坛后台,添加新插件
插件名称:随机奖罚系统
唯一标识:pet
前台文件:
后台文件:petset.php
相关文件:
hack/petset.php,data/bbscache/pet.php,template/wind/petset.htm
五、一些说明:
if(rand(1,1000) < $petset[diaobaolv] && strlen($atc_content) > $petset[wzhchdu])
这里控制中奖条件和中奖机率
其中的$petset[diaobaolv]是中奖机率(数字越大,中奖几率越大,超过1000都会中奖)
其中的$petset[wzhchdu]是限制贴子内容要在$petset[wzhchdu]字节($petset[wzhchdu]/2个汉字)以上才能中奖
这些在后台都可以设置。
六、后台管理
进入论坛后台一看就明白了。 |