المشاركة الأصلية كتبت بواسطة rider
(المشاركة 4930)
ف تريجر بوكس حط الكود ده بدل الي عندك و متنساش تعدل علي الريورد
كود بلغة HTML:
using system;
using system.collections.generic;
using system.drawing;
using system.linq;
using system.text;
using system.threading;
using mr_panda.client;
using mr_panda.interfaces;
using mr_panda.network.gamepackets;
namespace mr_panda.game
{
public class treasurebox
{
static map map = kernel.maps[3820];
const int max_boxes = 20, items = 1000, cpsmoney = 1001, level = 1002, death = 1003, stun = 1004, kick = 1005;
static int currentboxes = 0;
static mr_panda.interfaces.inpc npc;
static ushort tempx, tempy = 0;
static uint baseid = 101002;
static list<point> vaildones = new list<point>();
public static bool ongoing;
public static void generate()
{
try
{
if (currentboxes < max_boxes)
{
if (map == null)
{
map = kernel.maps[3820];
return;
}
tempx = (ushort)kernel.random.next(0, map.floor.bounds.width);
tempy = (ushort)kernel.random.next(0, map.floor.bounds.height);
if (map.floor[tempx, tempy, mapobjecttype.item, null])
{
npc = new network.gamepackets.npcspawn();
npc.uid = baseid++;
npc.mesh = (ushort)kernel.randfromgivingnums(9307, 9277, 9267, 9287, 9287, 9287 ,9257, 9257, 9257, 9257, 9257, 9257, 9307, 9307, 9307, 9307, 9307, 9277, 9267, 9267, 9267, 9277, 9277, 9277, 9277, 9277);
npc.type = enums.npctype.talker;
npc.mapid = map.id;
npc.x = tempx;
npc.y = tempy;
map.addnpc(npc);
currentboxes++;
kernel.sendworldmessage(new message("a new treasure box appeared!", color.red, 2012));
}
}
}
catch (exception e)
{
console.writeline(e.tostring());
}
}
public static void reward(gamestate client)
{
client.player.currenttreasureboxes++;
var orders = kernel.gamepool.values.orderbydescending(x => x.player.currenttreasureboxes).toarray();
for (int i = 0; i < orders.length + 1; i++)
{
if (i == 11) break;
message msg;
if (i == 0)
{
msg = new message("", system.drawing.color.red, message.firstrightcorner);
}
else
{
if (orders[i - 1].player.currenttreasureboxes == 0) continue;
msg = new message("no " + i.tostring() + "- " + orders[i - 1].player.name + " opened " + orders[i - 1].player.currenttreasureboxes.tostring() + " boxes!", system.drawing.color.red, message.continuerightcorner);
}
kernel.sendworldmessage(msg, program.gamepool, (ushort)3820);
}
int prize = 0;
if (client.player.level <= 135)
prize = kernel.randfromgivingnums(items, cpsmoney, kick, items, cpsmoney, items, cpsmoney, death);
else prize = kernel.randfromgivingnums(items, cpsmoney, kick, items, cpsmoney, items, cpsmoney, death);
//#warning treasure box prize
switch (prize)
{
case cpsmoney:
{
uint amount = (uint)kernel.random.next(100,2000);
if (amount <= 2000)
{
client.player.conquerpoints += amount;
kernel.sendworldmessage(new message(client.player.name + " got " + amount.tostring() + " cps while opening the treasurebox!", color.white, message.talk));
}
break;
}
case items:
{
database.conqueritembaseinformation temp;
uint itemid = (uint)kernel.randfromgivingnums(188755, 192935, 192775, 187405, 188105, 188705, 188945, 188515, 192825, 200220, 187855, 200475, 187405, 187415, 187425, 3004124, 183325, 183495, 184305, 184315, 184375, 187305, 187315, 181395, 184405, 184365);
client.inventory.add(itemid, 0, 1);
database.conqueriteminformation.baseinformations.trygetvalue(itemid, out temp);
kernel.sendworldmessage(new message(client.player.name + " got " + temp.name + " while opening the treasurebox!", color.white, message.talk));
break;
}
case kick:
{
client.player.teleport(1002, 338, 345);
kernel.sendworldmessage(new message(client.player.name + " got kicked-out! While opening the treasurebox!", color.white, message.talk));
break;
}
case death:
{
client.player.die(client.player);
kernel.sendworldmessage(new message(client.player.name + " got death! While opening the treasurebox!", color.white, message.talk));
break;
}
}
currentboxes--;
//client.entity.treasuerpoints += 1;
}
}
}
|