Fulfilled the lovely pull request #427 from @dragoso, which added in backing code content to HeavenMS. Implemented structural changes for the Marriage wishlist, in order to receive, maintain and distribute gifts to spouses. Added untradeable check on wishlist gift handler. Adjusted CPQ drops to actually load from DB rathe than hard-coded. Fixed CPQ "random disease to player/party" functionality not applying properly. Adjusted how CPQ maps are generated. It directly loads a new area from WZ (this process should at least removes the player's spawned mobs) rather than reset the cache at every MCPQ creation.
83 lines
3.1 KiB
JavaScript
83 lines
3.1 KiB
JavaScript
var cpqMinLvl = 30;
|
||
var cpqMaxLvl = 255;
|
||
var cpqMinAmt = 0;
|
||
var cpqMaxAmt = 6;
|
||
|
||
function start() {
|
||
status = -1;
|
||
action(1, 0, 0);
|
||
}
|
||
|
||
function action(mode, type, selection) {
|
||
if (mode == -1) {
|
||
cm.dispose();
|
||
} else {
|
||
if (mode == 0 && status == 0) {
|
||
cm.dispose();
|
||
return;
|
||
}
|
||
if (mode == 1)
|
||
status++;
|
||
else
|
||
status--;
|
||
if (status == 0) {
|
||
if (cm.getParty() == null) {
|
||
status = 10;
|
||
cm.sendOk("#e<> necess<73>rio criar um grupo antes de come<6D>ar o Festival de Monstros!#k");
|
||
} else if (!cm.isLeader()) {
|
||
status = 10;
|
||
cm.sendOk("Se voc<6F> quer come<6D>ar o Festival, avise o #bl<62>der do grupo#k para falar comigo.");
|
||
} else {
|
||
var leaderMapid = cm.getMapId();
|
||
var party = cm.getParty().getMembers();
|
||
var inMap = cm.partyMembersInMap();
|
||
var lvlOk = 0;
|
||
var isOutMap = 0;
|
||
for (var i = 0; i < party.size(); i++) {
|
||
if (party.get(i).getLevel() >= cpqMinLvl && party.get(i).getLevel() <= cpqMaxLvl) {
|
||
lvlOk++;
|
||
|
||
if (party.get(i).getPlayer().getMapId() != leaderMapid) {
|
||
isOutMap++;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (party >= 1) {
|
||
status = 10;
|
||
cm.sendOk("Voc<6F> n<>o tem n<>mero suficiente de pessoas em seu grupo. Voc<6F> precisa de um grupo com #b" + cpqMinAmt + "#k - #r" + cpqMaxAmt + "#k membros e eles devem estar no mapa com voc<6F>.");
|
||
} else if (lvlOk != inMap) {
|
||
status = 10;
|
||
cm.sendOk("Certifique se todos em seu grupo est<73>o dentre os n<>veis corretos (" + cpqMinLvl + "~" + cpqMaxLvl + ")!");
|
||
} else if (isOutMap > 0) {
|
||
status = 10;
|
||
cm.sendOk("Existe algu<67>m do grupo que n<>o esta no mapa!");
|
||
} else {
|
||
cm.sendCPQMapLists2();
|
||
}
|
||
}
|
||
} else if (status == 1) {
|
||
if (cm.fieldTaken2(selection)) {
|
||
if (cm.fieldLobbied2(selection)) {
|
||
cm.challengeParty2(selection);
|
||
cm.dispose();
|
||
} else {
|
||
cm.sendOk("A sala esta cheia.");
|
||
cm.dispose();
|
||
}
|
||
} else {
|
||
var party = cm.getParty().getMembers();
|
||
if ((selection === 0 || selection === 1 ) && party.size() < 1) {
|
||
cm.sendOk("Voc<6F> precisa de no m<>nimo 2 player para entrar na competi<74><69>o.");
|
||
} else if ((selection === 2 ) && party.size() < 1) {
|
||
cm.sendOk("Voc<6F> precisa de no m<>nimo 3 player para entrar na competi<74><69>o.");
|
||
} else {
|
||
cm.cpqLobby2(selection);
|
||
}
|
||
cm.dispose();
|
||
}
|
||
} else if (status == 11) {
|
||
cm.dispose();
|
||
}
|
||
}
|
||
} |