99Max综合娱乐网站(旧版)

 找回密码
 立即注册
查看: 1005|回复: 3

[共享] 抽奖系统,不知道好不好用~~

[复制链接]

升级   21.33%

发表于 2010-6-21 16:07:43 | 显示全部楼层 |阅读模式
*
* This file is part of aion-unique <aion-unique.com>.
*
* aion-unique is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* aion-unique is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with aion-unique.  If not, see <http://www.gnu.org/licenses/>.
*/
package admincommands;
import com.aionemu.gameserver.configs.administration.AdminConfig;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.services.ItemService;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.Util;
import com.aionemu.gameserver.utils.chathandlers.AdminCommand;
import com.aionemu.gameserver.world.World;
import com.google.inject.Inject;
import com.aionemu.commons.utils.Rnd;
import com.aionemu.gameserver.model.gameobjects.state.CreatureState;
/**
* @dutea 商业功能;
*
*/
public class Lottery extends AdminCommand
{
@Inject
private ItemService itemService;
@Inject
private World world;

public Lottery()
{
  super("抽奖");
}
@Override
public void executeCommand(Player admin, String[] params)
{
  if(admin.getAccessLevel() < 0)
  {
   PacketSendUtility.sendMessage(admin, "您没有权限使用!");
   return;
  }
  if(params.length > 0)
  {
   PacketSendUtility.sendMessage(admin, "格式//抽奖");
   return;
  }
  
  if(admin.getAccessLevel() < 2 && (admin.getWorldId() == 510010000 || admin.getWorldId() == 520010000))
  {
   PacketSendUtility.sendMessage(admin, "目前你正在服刑中,无法移动!刑满后,系统会自动释放你回程!");
   return;
  }
  if(admin.getAccessLevel() < 2 && admin.getState() != CreatureState.ACTIVE.getId())
  {
   PacketSendUtility.sendMessage(admin, "请在静止状态(战斗、飞行、死亡等不属于静止状态)使用此命令!");
   return;
  }
  
  int itemId = 0; //物品的ID
  int itemCount = 1;//物品的数量
  boolean openLottery = false;//公告
  int rndprc = Rnd.get(1, 100);//物品的几率数
  int djNum=10;//需要的积分是多少
  String lotteryLevel=null;
  //Player receiver = admin;//玩家
  
        if(admin.getCommonData().getPlayerDj() < djNum)
  {
    int oldDj = admin.getCommonData().getPlayerDj();
    int newDj = (int) Math.floor(djNum);
    admin.getCommonData().setPlayerDj(oldDj - newDj);
    switch(rndprc)
    {
     case 100:
      itemId = 101500605;
      lotteryLevel = "终极奖";
      openLottery = true;
      break;
     case 99:
      itemId = 115000860;
      lotteryLevel = "白金奖";
      openLottery = true;
      break;
     case 98:
      itemId = 101700620;
      lotteryLevel = "钻石奖";
      openLottery = true;
      break;
    }
   
    if(openLottery == true)
          {
  // int count = itemService.addItem(admin, itemId, itemCount);
        PacketSendUtility.sendMessage(admin, "—————【抽奖系统】—————");
       // PacketSendUtility.sendMessage(admin, "抽奖:获得[item:"+itemId+":verl;;]");
       itemService.addItem(admin, itemId, itemCount);
        PacketSendUtility.sendMessage(admin, "等级:"+lotteryLevel);
        PacketSendUtility.sendMessage(admin, "————————————————");
   }
   else
   {
    PacketSendUtility.sendMessage(admin, "—————【抽奖系统】—————");
    PacketSendUtility.sendMessage(admin, "说明:点数[100]终极奖\n 说明:点数[99]白金奖\n 说明:点数[98]钻石奖");
    PacketSendUtility.sendMessage(admin, "点数:这次您的点数是["+rndprc+"]");
    PacketSendUtility.sendMessage(admin, "————————————————");
             }
  }else{
       PacketSendUtility.sendMessage(admin, "抽奖失败!需要积分"+djNum);
    }
温馨提示:
1. 本站模拟器源于网络,经 99Max.mE 二次开发,仅供个人学习娱乐使用,切勿用于商业用途,否则后果自负!
2. 如需更好体验游戏内容,请前往官方游戏!不具备合法的运营模式,都是强盗,请勿擅自搭建私服!
3. 如本站内容有侵犯您的权益,请发送信息至QQ:372607220 或 EMAIL:372607220@qq.com ,我们会及时删除。

升级   6%

发表于 2010-6-21 18:14:29 | 显示全部楼层
不管有没有用顶下先
cjbpjj 该用户已被删除
发表于 2010-6-26 17:42:28 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽

升级   92%

发表于 2010-6-27 18:26:24 | 显示全部楼层
怎么用啊?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|99Max综合娱乐网站(旧版) ( 沪ICP备11024206号-1 )

GMT+8, 2025-6-8 20:20 , Processed in 0.941490 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表