Demo entry 6349553

ㅇㅇ

   

Submitted by anonymous on Feb 21, 2017 at 07:25
Language: JavaScript. Code size: 6.8 kB.

/*
	0  : STR
	1  : DEX
	2  : INT
	3  : LUK
	4  : STR + DEX
	5  : STR + INT
	6  : STR + LUK
	7  : DEX + INT
	8  : DEX + LUK
	9  : INT + LUK
	10 : 올스탯%
	11 : 착용 레벨 감소
	12 : 이동속도
	13 : 점프력
	14 : 공격력
	15 : 마력
	16 : HP
	17 : MP
	18 : 물리방어력
	19 : 마법방어력
	20 : 명중치
	21 : 보스
	22 : 데미지
	기본 : 회피치
*/

function start()
{
	St = -1;
	action(1, 0, 0);
}

function getChance()
{
	return cm.getPlayer().getKeyValue2("CHANCE_2434587");
}

function addChance(i)
{
	return cm.getPlayer().setKeyValue2("CHANCE_2434587", Number(Number(cm.getPlayer().getKeyValue2("CHANCE_2434587")) + Number(i)));
}

function action(M, T, S)
{	
	if(M != 1)
	{
		cm.dispose();
		return;
	}
	else
	{
		St++;
	}

	if(St == 0)
	{
		needItem = 2434587;
		if(!cm.haveItem(needItem, 15))
		{
			cm.sendOkS("#i"+needItem+":# #b#t"+needItem+"##k 15개를 모으면 #b150 레벨 파프니르 무기#k 1개를 선택하여 획득할 수 있습니다.", 4, 2007);
			cm.dispose();
			return;
		}

		if(getChance() < 0)
		{
			cm.getPlayer().setKeyValue2("CHANCE_2434587", 0);
		}
		rootAbyss = [1302275, 1312153, 1322203, 1232057, 1402196, 1412135, 1422140, 1432167, 1442223, 1582016, 1372177, 1382208, 1212063, 1262016, 1452205, 1462193, 1522094, 1332225, 1342082, 1362090, 1242060, 1472214, 1222058, 1242061, 1482168, 1492179, 1532098];
		selStr    = "#e#b찬스타임 게이지 : #r"+getChance()+"%#k#n\r\n\r\n"
		if(getChance() == 100)
		{
			selStr += "#e#r찬스타임 발동!#k\r\n#b더 좋은 추가옵션#k#n이 나올 확률이 증가합니다.\r\n\r\n";
		}
		selStr   += "받으실 무기를 선택해주세요.\r\n\r\n#b";
		for(i = 0; i < rootAbyss.length; i++)
		{
			selStr += "#L"+ i +"##i"+rootAbyss[i]+":# #t"+rootAbyss[i]+":#\r\n";
		}
		cm.sendSimpleS(selStr, 4, 2007);
	}

	else if(St == 1)
	{
		if(!cm.haveItem(needItem, 15))
		{
			cm.dispose();
			return;
		}

		addSelect = S;

		if(!cm.canHold(rootAbyss[addSelect]))
		{
			cm.dispose();
			return;
		}

		cm.sendSimpleS("받고싶은 장비가 이 장비가 확실한가요?\r\n\r\n"
				+ "#i"+rootAbyss[addSelect]+":# #b#t"+rootAbyss[addSelect]+":##k\r\n\r\n"
				+ "#e#r※주의※#k#n\r\n"
				+ "한 번 조각을 아이템으로 교환하면 #r15개의 조각이 차감#k되며, 다시 다른 아이템으로 교환할 수 없습니다.#b\r\n"
				+ "#L0#네 맞습니다.#l\r\n"	
				+ "#L1#아닙니다. 다시 선택하겠습니다.#l\r\n", 4, 2007);
	}

	else if(St == 2)
	{
		selType = S;
		if(selType == 1)
		{
			cm.dispose();
			cm.openNpc(2007, "consume_"+needItem+"");
			return;
		}
		addOption = [];
		finalType = [];


		for(i = 0; i < 5; i++)
		{
			addOption[i] = Math.floor(Math.random() * 24);
			for(z = 0; z < i; z++)
			{
				if(addOption[i] == addOption[z])
				{
					i--;
					break;
				}
			}
		}

		ii = Packages.server.items.ItemInformation.getInstance().getEquipById(rootAbyss[addSelect]);

		for(i = 0; i < addOption.length; i++)
		{
			if(addOption[i] == 14 || addOption[i] == 15)
			{
				getAtk();
				finalType[i] = listOfAdd[Math.floor(Math.random() * listOfAdd.length)];
			}
			else
			{
				if(getChance() == 100) //찬스타임
				{
					listOfAdd = [4, 5, 4, 5, 6, 7, 4];
				}
				else
				{
					listOfAdd = [3, 4, 3, 4, 5, 3, 4, 6, 3, 4, 7];
				}
				finalType[i] = listOfAdd[Math.floor(Math.random() * listOfAdd.length)];
			}
			setEquip(addOption[i],  finalType[i] * getDouble(addOption[i]));
		}

		if(getChance() == 100)
		{
			addChance(-100);
		}
		else
		{
			addChance(10);
		}
		cm.gainItem(needItem, -15);
		ii.setGMLog(""+Packages.tools.CurrentTime.getAllCurrentTime()+"에 "+cm.getPlayer().getName()+"의 조각으로 교환한 아이템");
		Packages.server.items.InventoryManipulator.addFromDrop(cm.getC(), ii, false);
		cm.getPlayer().send(Packages.packet.creators.MainPacketCreator.getGMText(6, "장비 아이템을 얻었습니다. ("+Packages.server.items.ItemInformation.getInstance().getName(rootAbyss[addSelect])+")"));
		cm.getPlayer().send(Packages.packet.creators.MainPacketCreator.getGMText(6, "아이템을 잃었습니다. ("+Packages.server.items.ItemInformation.getInstance().getName(needItem)+" 15개)"));

		cm.dispose();
	}
}

function getAtk()
{
	switch(ii.getWatk())
	{

		case 81:
		listOfAdd = [8, 13, 18, 25, 33];
		break;

		case 86:
		listOfAdd = [11, 16, 21, 28, 36];
		break;

		case 125:
		listOfAdd = [15, 22, 31, 40, 52];
		break;

		case 128:
		listOfAdd = [16, 23, 31, 41, 53];
		break;

		case 153:
		listOfAdd = [19, 27, 38, 49, 63];
		break;

		case 160:
		listOfAdd = [20, 29, 39, 52, 66];
		break;

		case 164:
		listOfAdd = [20, 29, 40, 53, 68];
		break;

		case 171:
		listOfAdd = [21, 31, 42, 55, 71];
		break;

		case 175:
		listOfAdd = [22, 31, 43, 56, 72];
		break;

		case 201:
		listOfAdd = [25, 36, 49, 65, 83];
		break;

		case 204:
		listOfAdd = [25, 36, 50, 66, 84];
		break;

		/* 스태프 */
		case 126:
		listOfAdd = [16, 22, 31, 41, 52];
		break;

		/* 완드, 샤이닝로드, ESP 리미터 */
		default:
		listOfAdd = [15, 21, 29, 38, 49];
	}
}

function setEquip(optionType, i)
{
	switch(optionType)
	{
		case 0:
		ii.setStr(ii.getStr() + i);
		break;

		case 1:
		ii.setDex(ii.getDex() + i);
		break;

		case 2:
		ii.setInt(ii.getInt() + i);
		break;

		case 3:
		ii.setLuk(ii.getInt() + i);
		break;

		case 4:
		ii.setStr(ii.getStr() + i);
		ii.setDex(ii.getDex() + i);
		break;

		case 5:
		ii.setStr(ii.getStr() + i);
		ii.setInt(ii.getInt() + i);
		break;

		case 6:
		ii.setStr(ii.getStr() + i);
		ii.setLuk(ii.getLuk() + i);
		break;

		case 7:
		ii.setDex(ii.getDex() + i);
		ii.setInt(ii.getInt() + i);
		break;

		case 8:
		ii.setDex(ii.getDex() + i);
		ii.setLuk(ii.getLuk() + i);
		break;

		case 9:
		ii.setInt(ii.getInt() + i);
		ii.setLuk(ii.getLuk() + i);
		break;

		case 10:
		ii.setAllStatP(i);
		break;

		case 11:
		ii.setDownLevel(i);
		break;

		case 12:
		ii.setSpeed(i);
		break;

		case 13:
		ii.setJump(i);
		break;

		case 14:
		ii.setWatk(ii.getWatk() + i);
		break;

		case 15:
		ii.setMatk(ii.getMatk() + i);
		break;

		case 16:
		ii.setHp(ii.getHp() + i);
		break;

		case 17:
		ii.setMp(ii.getMp() + i);
		break;

		case 18:
		ii.setWdef(ii.getWdef() + i);
		break;

		case 19:
		ii.setMdef(ii.getMdef() + i);
		break;

		case 20:
		ii.setAcc(ii.getAcc() + i);
		break;

		case 21:
		ii.setBossDamage(ii.getBossDamage() + i);
		break;

		case 22:
		ii.setAllDamageP(ii.getAllDamageP() + i);
		break;

		default:
		ii.setAvoid(ii.getAvoid() + i);
	}	
}

function getDouble(i)
{
	switch(i)
	{
		case 0:
		case 1:
		case 2:
		case 3:
		case 18:
		case 19:
			 return 8;

		case 4:
		case 5:
		case 6:
		case 7:
		case 8:
		case 9:
			 return 4;

		case 10:
		case 12:
		case 13:
		case 14:
		case 15:
		case 22:
			 return 1;

		case 11:
			 return 5;

		case 16:
		case 17:
			 return 450;

		case 21:
			 return 2;

		default:
			 return 38;
	}
}

This snippet took 0.02 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).