本文整理汇总了Java中tools.packet.CWvsContext类的典型用法代码示例。如果您正苦于以下问题:Java CWvsContext类的具体用法?Java CWvsContext怎么用?Java CWvsContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CWvsContext类属于tools.packet包,在下文中一共展示了CWvsContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gainGachaponItem
import tools.packet.CWvsContext; //导入依赖的package包/类
public int gainGachaponItem(int id, int quantity, final String msg) {
try {
if (!MapleItemInformationProvider.getInstance().itemExists(id)) {
return -1;
}
final Item item = MapleInventoryManipulator.addbyId_Gachapon(c, id, (short) quantity);
if (item == null) {
return -1;
}
final byte rareness = GameConstants.gachaponRareItem(item.getItemId());
if (rareness > 0) {
World.Broadcast.broadcastMessage(CWvsContext.getGachaponMega(c.getPlayer().getName(), " : got a(n)",
c.getChannel(), item, (byte) 2, "From Gachapon"));
}
c.getSession().write(InfoPacket.getShowItemGain(item.getItemId(), (short) quantity, true));
return item.getItemId();
} catch (Exception e) {
}
return -1;
}
示例2: registerExpedition
import tools.packet.CWvsContext; //导入依赖的package包/类
public boolean registerExpedition(String type, int minutes, String startText) {
if (c.getChannelServer().getMapleSquad(type) == null) {
final MapleSquad squad = new MapleSquad(c.getChannel(), type, c.getPlayer(), minutes * 60 * 1000,
startText);
final boolean ret = c.getChannelServer().addMapleSquad(squad, type);
if (ret) {
final MapleMap map = c.getPlayer().getMap();
map.broadcastMessage(CField.getClock(minutes * 60));
map.broadcastMessage(CWvsContext.broadcastMsg(-6, startText));
} else {
squad.clear();
}
return ret;
}
return false;
}
示例3: registerSquad
import tools.packet.CWvsContext; //导入依赖的package包/类
public boolean registerSquad(String type, int minutes, String startText) {
if (c.getChannelServer().getMapleSquad(type) == null) {
final MapleSquad squad = new MapleSquad(c.getChannel(), type, c.getPlayer(), minutes * 60 * 1000,
startText);
final boolean ret = c.getChannelServer().addMapleSquad(squad, type);
if (ret) {
final MapleMap map = c.getPlayer().getMap();
map.broadcastMessage(CField.getClock(minutes * 60));
map.broadcastMessage(CWvsContext.broadcastMsg(6, c.getPlayer().getName() + startText));
} else {
squad.clear();
}
return ret;
}
return false;
}
示例4: increaseGuildCapacity
import tools.packet.CWvsContext; //导入依赖的package包/类
public void increaseGuildCapacity(boolean trueMax) {
if (c.getPlayer().getMeso() < 500000 && !trueMax) {
c.getSession().write(CWvsContext.broadcastMsg(1, "You do not have enough mesos."));
return;
}
final int gid = c.getPlayer().getGuildId();
if (gid <= 0) {
return;
}
if (World.Guild.increaseGuildCapacity(gid, trueMax)) {
if (!trueMax) {
c.getPlayer().gainMeso(-500000, true, true);
} else {
gainGP(-10000);
}
sendNext("Your guild capacity has been raised...");
} else if (!trueMax) {
sendNext("Please check if your guild capacity is full. (Limit: 100)");
} else {
sendNext(
"Please check if your guild capacity is full, if you have the GP needed or if subtracting GP would decrease a guild level. (Limit: 200)");
}
}
示例5: handle
import tools.packet.CWvsContext; //导入依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.CHANGE_CHANNEL)
public static void handle(MapleClient c, LittleEndianAccessor lea){
MapleCharacter chr = c.getPlayer();
int toChannel = lea.readByte() + 1;
if (chr == null || chr.hasBlockedInventory() || chr.getEventInstance() != null || chr.getMap() == null || chr.isInBlockedMap() || FieldLimitType.ChannelSwitch.check(chr.getMap().getFieldLimit()) || c.getChannel() == toChannel) {
c.getSession().write(CWvsContext.enableActions());
return;
}
if (World.getPendingCharacterSize() >= 10 || !World.isChannelAvailable(toChannel, chr.getWorld())) {
chr.dropMessage(1, "We could not change your channel at this moment. Please try again soon.");
c.getSession().write(CWvsContext.enableActions());
return;
}
int tick = lea.readInt();
chr.changeChannel(toChannel);
}
示例6: mihileMove913070001
import tools.packet.CWvsContext; //导入依赖的package包/类
public void mihileMove913070001() {
try {
c.getPlayer().getClient().getSession().write(CField.UIPacket.getDirectionInfo((byte) 3, 2));
c.getPlayer().getClient().getSession().write(CField.UIPacket.getDirectionInfo((byte) 1, 800));
Thread.sleep(800);
} catch (InterruptedException e) {
}
c.getSession().write(CField.UIPacket.IntroEnableUI(0));
c.getSession().write(CField.UIPacket.IntroDisableUI(false));
while (c.getPlayer().getLevel() < 2) {
c.getPlayer().levelUp();
}
c.getPlayer().setExp(0);
warp(913070001, 0);
c.getSession().write(CWvsContext.enableActions());
}
示例7: execute
import tools.packet.CWvsContext; //导入依赖的package包/类
@Override
public int execute(MapleClient c, String[] splitted) {
minutesLeft = Integer.parseInt(splitted[1]);
c.getPlayer().dropMessage(6, "Shutting down... in " + minutesLeft + " minutes");
if (ts == null && (t == null || !t.isAlive())) {
t = new Thread(ShutdownServer.getInstance());
ts = EventTimer.getInstance().register(new Runnable() {
@Override
public void run() {
if (minutesLeft == 0) {
ShutdownServer.getInstance().shutdown();
t.start();
ts.cancel(false);
return;
}
World.Broadcast.broadcastMessage(CWvsContext.broadcastMsg(0, "The server will shutdown in " + minutesLeft + " minutes. Please log off safely."));
minutesLeft--;
}
}, 60000);
} else {
c.getPlayer().dropMessage(6, "A shutdown thread is already in progress or shutdown has not been done. Please wait.");
}
return 1;
}
示例8: dispose
import tools.packet.CWvsContext; //导入依赖的package包/类
public final void dispose(final MapleClient c) {
final NPCConversationManager npccm = cms.get(c);
if (npccm != null) {
cms.remove(c);
if (npccm.getType() == -1) {
c.removeScriptEngine("scripts/npc/" + npccm.getNpc() + ".js");
c.removeScriptEngine("scripts/npc/" + npccm.getScript() + ".js");
c.removeScriptEngine("scripts/npc/notcoded.js");
} else {
c.removeScriptEngine("scripts/quest/" + npccm.getQuest() + ".js");
}
}
if (c.getPlayer() != null && c.getPlayer().getConversation() == 1) {
c.getPlayer().setConversation(0);
}
c.getSession().write(CWvsContext.enableActions());
}
示例9: execute
import tools.packet.CWvsContext; //导入依赖的package包/类
@Override
public int execute(MapleClient c, String[] splitted) {
if (splitted.length > 1) {
StringBuilder sb = new StringBuilder();
sb.append("[");
if (!c.getPlayer().isGM()) {
sb.append("Intern ");
}
sb.append(c.getPlayer().getName());
sb.append("] ");
sb.append(StringUtil.joinStringFrom(splitted, 1));
World.Broadcast.broadcastMessage(CWvsContext.broadcastMsg(c.getPlayer().isGM() ? 6 : 5, sb.toString()));
} else {
c.getPlayer().dropMessage(6, "Syntax: say <message>");
return 0;
}
return 1;
}
示例10: memberLevelJobUpdate
import tools.packet.CWvsContext; //导入依赖的package包/类
public final void memberLevelJobUpdate(final MapleGuildCharacter mgc) {
for (final MapleGuildCharacter member : members) {
if (member.getId() == mgc.getId()) {
int old_level = member.getLevel();
int old_job = member.getJobId();
member.setJobId(mgc.getJobId());
member.setLevel((short) mgc.getLevel());
if (mgc.getLevel() > old_level) {
gainGP((mgc.getLevel() - old_level) * mgc.getLevel(), false, mgc.getId());
//aftershock: formula changes (below 100 = 40, above 100 = 80) (12000 max) but i prefer level (21100 max), add guildContribution, do setGuildAndRank or just get the MapleCharacter object
}
if (old_level != mgc.getLevel()) {
this.broadcast(CWvsContext.sendLevelup(false, mgc.getLevel(), mgc.getName()), mgc.getId());
}
if (old_job != mgc.getJobId()) {
this.broadcast(CWvsContext.sendJobup(false, mgc.getJobId(), mgc.getName()), mgc.getId());
}
broadcast(GuildPacket.guildMemberLevelJobUpdate(mgc));
if (allianceid > 0) {
World.Alliance.sendGuild(AlliancePacket.updateAlliance(mgc, allianceid), id, allianceid);
}
break;
}
}
}
示例11: partyChat
import tools.packet.CWvsContext; //导入依赖的package包/类
public static void partyChat(int partyid, String chattext, String namefrom, int mode) {
MapleParty party = getParty(partyid);
if (party == null) {
return;
}
for (MaplePartyCharacter partychar : party.getMembers()) {
int ch = Find.findChannel(partychar.getName());
if (ch > 0) {
MapleCharacter chr = ChannelServer.getInstance(ch).getPlayerStorage().getCharacterByName(partychar.getName());
if (chr != null && !chr.getName().equalsIgnoreCase(namefrom)) { //Extra check just in case
chr.getClient().getSession().write(CField.multiChat(namefrom, chattext, mode));
if (chr.getClient().isMonitored()) {
World.Broadcast.broadcastGMMessage(CWvsContext.broadcastMsg(6, "[GM Message] " + namefrom + " said to " + chr.getName() + " (Party): " + chattext));
}
}
}
}
}
示例12: UseTitle
import tools.packet.CWvsContext; //导入依赖的package包/类
public static void UseTitle(int itemId, MapleClient c, MapleCharacter chr) {
if ((chr == null) || (chr.getMap() == null)) {
return;
}
Item toUse = chr.getInventory(MapleInventoryType.SETUP).findById(itemId);
if (toUse == null) {
return;
}
if (itemId <= 0) {
chr.getQuestRemove(MapleQuest.getInstance(124000));
} else {
chr.getQuestNAdd(MapleQuest.getInstance(124000)).setCustomData(String.valueOf(itemId));
}
chr.getMap().broadcastMessage(chr, CField.showTitle(chr.getId(), itemId), false);
c.getSession().write(CWvsContext.enableActions());
}
示例13: SkillEffect
import tools.packet.CWvsContext; //导入依赖的package包/类
public static void SkillEffect(LittleEndianAccessor slea, MapleCharacter chr) {
int skillId = slea.readInt();
if (skillId >= 91000000 && skillId < 100000000) {
chr.getClient().getSession().write(CWvsContext.enableActions());
return;
}
byte level = slea.readByte();
short direction = slea.readShort();
byte unk = slea.readByte();
Skill skill = SkillFactory.getSkill(GameConstants.getLinkedAttackSkill(skillId));
if ((chr == null) || (skill == null) || (chr.getMap() == null)) {
return;
}
int skilllevel_serv = chr.getTotalSkillLevel(skill);
if ((skilllevel_serv > 0) && (skilllevel_serv == level) && ((skillId == 33101005) || (skill.isChargeSkill()))) {
chr.setKeyDownSkill_Time(System.currentTimeMillis());
if (skillId == 33101005) {
chr.setLinkMid(slea.readInt(), 0);
}
chr.getMap().broadcastMessage(chr, CField.skillEffect(chr, skillId, level, direction, unk), false);
}
}
示例14: updateRedLeafHigh
import tools.packet.CWvsContext; //导入依赖的package包/类
public static void updateRedLeafHigh(LittleEndianAccessor slea, MapleClient c) { //not finished yet
//TODO: load and set red leaf high in sql
slea.readInt(); //questid or something
slea.readInt(); //joe joe quest
int joejoe = slea.readInt();
slea.readInt(); //hermoninny quest
int hermoninny = slea.readInt();
slea.readInt(); //little dragon quest
int littledragon = slea.readInt();
slea.readInt(); //ika quest
int ika = slea.readInt();
if (joejoe + hermoninny + littledragon + ika != c.getPlayer().getFriendShipToAdd()) {
c.getSession().write(CWvsContext.enableActions());
return;
}
c.getPlayer().setFriendShipPoints(joejoe, hermoninny, littledragon, ika);
}
示例15: UseCosmetic
import tools.packet.CWvsContext; //导入依赖的package包/类
public static final void UseCosmetic(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
if (chr == null || !chr.isAlive() || chr.getMap() == null || chr.hasBlockedInventory() || chr.inPVP()) {
c.getSession().write(CWvsContext.enableActions());
return;
}
final byte slot = (byte) slea.readShort();
final int itemId = slea.readInt();
final Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId || itemId / 10000 != 254 || (itemId / 1000) % 10 != chr.getGender()) {
c.getSession().write(CWvsContext.enableActions());
return;
}
if (MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId()).applyTo(chr)) {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
}
}