Untitled
raw download clone
TEXT
views 19
,
size 13014 b
/*

add to item_db2.sql

// Mining Pickaxe
INSERT INTO `item_db2` VALUES (3500, 'Pickaxe_', 'Pickaxe', 4, 30000, NULL, 100, NULL, 0, NULL, 0, 4294967295, 7, 2, 128, NULL, 0, 0, 0, NULL, NULL, NULL),
INSERT INTO `item_db2` VALUES (3501, 'Super_Pickaxe_', 'Super Pickaxe', 4, 30000, NULL, 100, NULL, 0, NULL, 0, 4294967295, 7, 2, 128, NULL, 0, 0, 0, NULL, NULL, NULL);

// Energy Potion
// Description : Restores Energy by 5
INSERT INTO `item_db2` VALUES (3503,'S_Energy_Potion','Small Energy Potion',0,50,NULL,70,NULL,NULL,NULL,NULL,0xFFFFFFFF,7,2,NULL,NULL,NULL,NULL,NULL,'set #ENERGY, #ENERGY+5; if ( #ENERGY > #MAX_ENERGY ) set #ENERGY, #MAX_ENERGY; callfunc "energy_check"; specialeffect2 EF_HEAL;',NULL,NULL);

// Description : Restores Energy by 10
INSERT INTO `item_db2` VALUES (3504,'M_Energy_Potion','Medium Energy Potion',0,50,NULL,70,NULL,NULL,NULL,NULL,0xFFFFFFFF,7,2,NULL,NULL,NULL,NULL,NULL,'set #ENERGY, #ENERGY+10; if ( #ENERGY > #MAX_ENERGY ) set #ENERGY, #MAX_ENERGY; callfunc "energy_check"; specialeffect2 EF_HEAL;',NULL,NULL);

// Description : Restores Energy by 15
INSERT INTO `item_db2` VALUES (3505,'L_Energy_Potion','Large Energy Potion',0,50,NULL,70,NULL,NULL,NULL,NULL,0xFFFFFFFF,7,2,NULL,NULL,NULL,NULL,NULL,'set #ENERGY, #ENERGY+15; if ( #ENERGY > #MAX_ENERGY ) set #ENERGY, #MAX_ENERGY; callfunc "energy_check"; specialeffect2 EF_HEAL;',NULL,NULL);

// Description : Restores Energy to full
INSERT INTO `item_db2` VALUES (3506,'F_Energy_Potion','Full Energy Potion',0,50,NULL,70,NULL,NULL,NULL,NULL,0xFFFFFFFF,7,2,NULL,NULL,NULL,NULL,NULL,'set #ENERGY, #MAX_ENERGY; callfunc "energy_check"; specialeffect2 EF_HEAL;',NULL,NULL);


=== Normal Pickaxe Drop rates
Oridecon 70%
Elunium 70%
Bradium 50%
Carnium 50%
HD Carnium 20%
HD Bradium 20%
HD Oridecon 20%
HD Elunium 20%
Enriched Oridecon 10%
Enriched Elunium 10%
Charcoal - Replace to Black Magic Stone 10%
Cursed Magical Stone 10%
** 5 Seconds mining time
** 20% chance no energy consume

== Donate Pickaxe Drop rates (+10%)
Oridecon 80%
Elunium 80%
Bradium 60%
Carnium 60%
HD Carnium 30%
HD Bradium 30%
HD Oridecon 30%
HD Elunium 30%
Enriched Oridecon 20%
Enriched Elunium 20%
Charcoal - Replace to Black Magic Stone 20%
Cursed Magical Stone 20%
** 2 Seconds mining time
** 50% chance no energy consume

*/

function	script	energy_check	{
	dispbottom "Current Energy : [ "+#ENERGY+" / "+#MAX_ENERGY+" ]", 0x06e5ff;
	return;
}

-	script	Energy_System	-1,{
OnInit:
	// How much energy will player gain?
	.gain_energy = 0;

	// @energy to check your current energy..
	bindatcmd "energy", strnpcinfo(0)+"::OnCheckEnergy";

	// Initial energy.
	.energy = 50;

	initnpctimer;
	end;

OnPCLogoutEvent:
	#LOGOUT_ENERGY = gettimetick(2);
	end;

OnPCLoginEvent:
	if ( #MAX_ENERGY != .energy ) #MAX_ENERGY = .energy;
	if ( #LOGOUT_ENERGY ) {
		.@time = gettimetick(2) - #LOGOUT_ENERGY;
		if ( .@time > 3600 * 2 ) {
			.@gain = .@time / 3600 * 2;
			#ENERGY += .@gain;
			if ( #ENERGY >= #MAX_ENERGY ) #ENERGY = #MAX_ENERGY;
		}
	}
	OnCheckEnergy:
	energy_check;
	end;

OnTimer120000:
	foreachinserver strnpcinfo(0)+"::OnSGainCheck";
	setnpctimer 0;
	end;

OnSGainCheck:
	.@gain = .gain_energy;
	if ( !checkvending() ) {
		#ENERGY += .@gain;
		if ( #ENERGY >= #MAX_ENERGY ) #ENERGY = #MAX_ENERGY;
	}
	end;
}

function	script	E_Check_Hit	{
	.@npcid = getarg(0, 0);
	.@check = getarg(1, 0);
	if (.@npcid == 0)
		return;
	.@limit = 100;

	// 1 = Char
	// 2 = Account
	.@CharOrAccount = 1;
	
	.@type = ((.@CharOrAccount == 1) ? getcharid(0) : getcharid(3));

	if (.@check && getd("$@hit_"+ .@npcid +"["+ .@type +"]") >= .@limit)
	{
		.@reset = getd("$@tick_"+ .@npcid +"["+ .@type +"]");
		if (.@reset + 600 <= gettimetick(2)) // reset when or after 10 minutes pass from last hit
		{
			setd("$@hit_"+ .@npcid +"["+ .@type +"]"), 0;
			return;
		}
		message strcharinfo(0), "you have been mining this spot for 100 times, please change to another mining spot";
		end;
	}
	setd("$@hit_"+ .@npcid +"["+ .@type +"]"), getd("$@hit_"+ .@npcid +"[" +.@type +"]") + 1;
	setd("$@tick_"+ .@npcid +"["+ .@type +"]"), gettimetick(2);
	return;
}

-	script	mine_spot	-1,{
	do {
		.@equipid = getequipid(EQI_ACC_L);
		if ( .@equipid < .pickaxe[0] || .@equipid > .pickaxe[1] ) {
			message strcharinfo(0),"I must equip a pickaxe to mine here!";
			end;
		}
		callfunc("E_Check_Hit", getnpcid(0), 1);
		if ( .@equipid == .pickaxe[0] ) {
			.@time = 5; 		// 5 sec casting
			.@consume = 20; 		// 20% no consume
			.@amount = 1;        // 1 drops
		} else if ( .@equipid == .pickaxe[1] ) {
			.@bonus = 1000; 	// +10% drop rate if super pickaxe
			.@time = 3; 		// 3 sec casting
			.@consume = 50; 		// 50% no consume
			.@amount = 1;        // 1 drops
		}
		deletearray .@T$[0], getarraysize(.@T$);
		explode(.@T$,.dropData$,",");
		if ( #ENERGY < 1 ) {
			showscript "Insufficient energy.", getcharid(3);
			dispbottom "I need more energy to mine.", 0xff0000;
			end;
		}
		progressbar "", .@time;
		deletearray .@TT$[0], getarraysize(.@TT$);
		explode(.@TT$,.@T$[rand(getarraysize(.@T$))],":");
		.@itemid = atoi(.@TT$[0]);
		.@rate = atoi(.@TT$[1]) + .@bonus;
		if ( .@consume <= rand(100) ) --#ENERGY;
		energy_check;
		if (.@rate >= rand(0,10000))
		{
			specialeffect 51;
			specialeffect2 610;
			showscript getitemname(.@itemid)+" found!",getcharid(3);
			getitem .@itemid, .@amount;
		}
		else
		{
			specialeffect2 611;
			showscript rand(2) ? "Nothing found..." : "Try again...",getcharid(3);
		}
		callfunc("E_Check_Hit", getnpcid(0), 0);
	} while(1);
	end;

OnInit:
	.pickaxe[0] = 3500; // normal pickaxe id
	.pickaxe[1] = 3501; // super pickaxe id
	.dropData$ = "45009:2000,45010:2000,45011:2000,45012:2000,45013:2000";
	end;
}

// Add more duplicates
anthell01,47,254,1	duplicate(mine_spot)	Mining Spot#001	1907
anthell01,43,241,1	duplicate(mine_spot)	Mining Spot#002	1908
anthell01,53,235,1	duplicate(mine_spot)	Mining Spot#003	1907
anthell01,60,236,1	duplicate(mine_spot)	Mining Spot#004	1908
anthell01,66,229,1	duplicate(mine_spot)	Mining Spot#005	1907
anthell01,65,222,1	duplicate(mine_spot)	Mining Spot#006	1908
anthell01,81,209,1	duplicate(mine_spot)	Mining Spot#007	1907
anthell01,99,230,1	duplicate(mine_spot)	Mining Spot#008	1908
anthell01,97,242,1	duplicate(mine_spot)	Mining Spot#009	1907


-	script	medium_spot	-1,{
	do {
		.@equipid = getequipid(EQI_ACC_L);
		if ( .@equipid < .pickaxe[0] || .@equipid > .pickaxe[1] ) {
			message strcharinfo(0),"I must equip a pickaxe to mine here!";
			end;
		}
		callfunc("E_Check_Hit", getnpcid(0), 1);
		if ( .@equipid == .pickaxe[0] ) {
			.@time = 5; 		// 5 sec casting
			.@consume = 20; 		// 20% no consume
			.@amount = 1;        // 2 drops
		} else if ( .@equipid == .pickaxe[1] ) {
			.@bonus = 1000; 	// +10% drop rate if super pickaxe
			.@time = 3; 		// 3 sec casting
			.@consume = 50; 		// 50% no consume
			.@amount = 1;        // 3 drops
		}
		deletearray .@T$[0], getarraysize(.@T$);
		explode(.@T$,.dropData$,",");
		if ( #ENERGY < 1 ) {
			showscript "Insufficient energy.", getcharid(3);
			dispbottom "I need more energy to mine.", 0xff0000;
			end;
		}
		progressbar "", .@time;
		deletearray .@TT$[0], getarraysize(.@TT$);
		explode(.@TT$,.@T$[rand(getarraysize(.@T$))],":");
		.@itemid = atoi(.@TT$[0]);
		.@rate = atoi(.@TT$[1]) + .@bonus;
		if ( .@consume <= rand(100) ) --#ENERGY;
		energy_check;
		if (.@rate >= rand(0,10000))
		{
			specialeffect 51;
			specialeffect2 610;
			showscript getitemname(.@itemid)+" found!",getcharid(3);
			getitem .@itemid, .@amount;
		}
		else
		{
			specialeffect2 611;
			showscript rand(2) ? "Nothing found..." : "Try again...",getcharid(3);
		}
		callfunc("E_Check_Hit", getnpcid(0), 0);
	} while(1);
	end;

OnInit:
	.pickaxe[0] = 3500; // normal pickaxe id
	.pickaxe[1] = 3501; // super pickaxe id
	.dropData$ = "45009:2000,45010:2000,45011:2000,45012:2000,45013:2000";
	end;
}

// Add more duplicates
beach_dun,233,138,1	duplicate(medium_spot)	Aquastone#001	1907
beach_dun,240,153,1	duplicate(medium_spot)	Aquastone#002	1908
beach_dun,209,40,1	duplicate(medium_spot)	Aquastone#003	1907
beach_dun,87,132,1	duplicate(medium_spot)	Aquastone#004	1908
beach_dun,66,246,1	duplicate(medium_spot)	Aquastone#005	1907
beach_dun,28,191,1	duplicate(medium_spot)	Aquastone#006	1908
beach_dun,34,104,1	duplicate(medium_spot)	Aquastone#007	1907
beach_dun,60,87,1	duplicate(medium_spot)	Aquastone#008	1908

-	script	magma_spot	-1,{
	do {
		.@equipid = getequipid(EQI_ACC_L);
		if ( .@equipid < .pickaxe[0] || .@equipid > .pickaxe[1] ) {
			message strcharinfo(0),"I must equip a pickaxe to mine here!";
			end;
		}
		callfunc("E_Check_Hit", getnpcid(0), 1);
		if ( .@equipid == .pickaxe[0] ) {
			.@time = 5; 		// 5 sec casting
			.@consume = 20; 		// 20% no consume
			.@amount = 1;        // 2 drops
		} else if ( .@equipid == .pickaxe[1] ) {
			.@bonus = 1000; 	// +10% drop rate if super pickaxe
			.@time = 3; 		// 3 sec casting
			.@consume = 50; 		// 50% no consume
			.@amount = 1;        // 3 drops
		}
		deletearray .@T$[0], getarraysize(.@T$);
		explode(.@T$,.dropData$,",");
		if ( #ENERGY < 1 ) {
			showscript "Insufficient energy.", getcharid(3);
			dispbottom "I need more energy to mine.", 0xff0000;
			end;
		}
		progressbar "", .@time;
		deletearray .@TT$[0], getarraysize(.@TT$);
		explode(.@TT$,.@T$[rand(getarraysize(.@T$))],":");
		.@itemid = atoi(.@TT$[0]);
		.@rate = atoi(.@TT$[1]) + .@bonus;
		if ( .@consume <= rand(100) ) --#ENERGY;
		energy_check;
		if (.@rate >= rand(0,10000))
		{
			specialeffect 51;
			specialeffect2 610;
			showscript getitemname(.@itemid)+" found!",getcharid(3);
			getitem .@itemid, .@amount;
		}
		else
		{
			specialeffect2 611;
			showscript rand(2) ? "Nothing found..." : "Try again...",getcharid(3);
		}
		callfunc("E_Check_Hit", getnpcid(0), 0);
	} while (1);
	end;

OnInit:
	.pickaxe[0] = 3500; // normal pickaxe id
	.pickaxe[1] = 3501; // super pickaxe id
	.dropData$ = "45009:2000,45010:2000,45011:2000,45012:2000,45013:2000";
	end;
}

// Add more duplicates
mag_dun01,124,121,1	duplicate(magma_spot)	Magmastone#001	1907
mag_dun01,55,103,1	duplicate(magma_spot)	Magmastone#002	1908
mag_dun01,57,32,1	duplicate(magma_spot)	Magmastone#003	1907
mag_dun01,93,156,1	duplicate(magma_spot)	Magmastone#004	1908
mag_dun01,57,192,1	duplicate(magma_spot)	Magmastone#005	1907
mag_dun01,130,233,1	duplicate(magma_spot)	Magmastone#006	1908
mag_dun01,228,231,1	duplicate(magma_spot)	Magmastone#007	1907
mag_dun01,161,189,1	duplicate(magma_spot)	Magmastone#008	1908

-	script	tunnel_spot	-1,{
	do {
		.@equipid = getequipid(EQI_ACC_L);
		if ( .@equipid < .pickaxe[0] || .@equipid > .pickaxe[1] ) {
			message strcharinfo(0),"I must equip a pickaxe to mine here!";
			end;
		}
		callfunc("E_Check_Hit", getnpcid(0), 1);
		if ( .@equipid == .pickaxe[0] ) {
			.@time = 5; 		// 5 sec casting
			.@consume = 20; 		// 20% no consume
			.@amount = 1;        // 2 drops
		} else if ( .@equipid == .pickaxe[1] ) {
			.@bonus = 1000; 	// +10% drop rate if super pickaxe
			.@time = 3; 		// 3 sec casting
			.@consume = 50; 		// 50% no consume
			.@amount = 1;        // 3 drops
		}
		deletearray .@T$[0], getarraysize(.@T$);
		explode(.@T$,.dropData$,",");
		if ( #ENERGY < 1 ) {
			showscript "Insufficient energy.", getcharid(3);
			dispbottom "I need more energy to mine.", 0xff0000;
			end;
		}
		progressbar "", .@time;
		deletearray .@TT$[0], getarraysize(.@TT$);
		explode(.@TT$,.@T$[rand(getarraysize(.@T$))],":");
		.@itemid = atoi(.@TT$[0]);
		.@rate = atoi(.@TT$[1]) + .@bonus;
		if ( .@consume <= rand(100) ) --#ENERGY;
		energy_check;
		if (.@rate >= rand(0,10000))
		{
			specialeffect 51;
			specialeffect2 610;
			showscript getitemname(.@itemid)+" found!",getcharid(3);
			getitem .@itemid, .@amount;
			end;
		}
		else
		{
			specialeffect2 611;
			showscript rand(2) ? "Nothing found..." : "Try again...",getcharid(3);
		}
		callfunc("E_Check_Hit", getnpcid(0), 0);
	} while(1);
	end;

OnInit:
	.pickaxe[0] = 3500; // normal pickaxe id
	.pickaxe[1] = 3501; // super pickaxe id
	.dropData$ = "45009:2000,45010:2000,45011:2000,45012:2000,45013:2000";
	end;
}

// Add more duplicates
dic_dun01,180,37,1	duplicate(tunnel_spot)	Kamidalstone#001	1907
dic_dun01,40,49,1	duplicate(tunnel_spot)	Kamidalstone#002	1908
dic_dun01,257,104,1	duplicate(tunnel_spot)	Kamidalstone#003	1907
dic_dun01,156,106,1	duplicate(tunnel_spot)	Kamidalstone#004	1908
dic_dun01,325,187,1	duplicate(tunnel_spot)	Kamidalstone#005	1907
dic_dun01,152,177,1	duplicate(tunnel_spot)	Kamidalstone#006	1908
dic_dun01,47,163,1	duplicate(tunnel_spot)	Kamidalstone#007	1907
dic_dun01,255,234,1	duplicate(tunnel_spot)	Kamidalstone#008	1908
close fullscreen
Login or Register to edit or fork this paste. It's free.