UID5494
阅读权限20
威望 点
积分82
注册时间2010-6-19
最后登录1970-1-1
听众
收听
升级
  21.33%
|
*
* 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 ,我们会及时删除。
|