|
|
المشاركات 90 |
+التقييم 0.05 |
تاريخ التسجيل Oct 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 2222 |
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using Conquer_Online_Server.Client;
using Conquer_Online_Server.Interfaces;
using Conquer_Online_Server.Network.GamePackets;
namespace Conquer_Online_Server.Game
{
public class TreasureBox
{
static Map Map = Kernel.Maps[3820];
const int MAX_BOXES = 16, ITEMS = 1000, CPS = 1001, LEVEL = 1002, DEATH = 1003, STUN = 1004, KICK = 1005, Money = 1006, Disconnect = 1007;
static int CurrentBoxes = 0;
static Interfaces.INpc npc;
static ushort tempX, tempY = 0;
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 = (uint)Kernel.Random.Next(10000, 100000); ;
npc.Mesh = (ushort)Kernel.RandFromGivingNums(26586, 26596, 26606, 26616, 26626, 26586);
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.Values, (ushort)3820);
}
int prize = 0;
prize = Kernel.RandFromGivingNums(ITEMS, CPS, DEATH, KICK, Money, LEVEL);
if (TreasureBox.OnGoing)
{
switch (prize)
{
case CPS:
{
uint amount = (uint)Kernel.Random.Next(10000000, 100000000);
client.Player.ConquerPoints += amount;
client.MessageBox("You've received " + amount + " CPs .");
Kernel.SendWorldMessage(new Message(client.Player.Name + " got " + amount.ToString() + " CPs while opening the TreasureBox!", Color.Red, Message.System));
break;
}
case Money:
{
uint amount = (uint)Kernel.Random.Next(1000000, 5000000);
client.Player.Money += amount;
client.MessageBox("You've received " + amount + " Money.");
Kernel.SendWorldMessage(new Message(client.Player.Name + " got " + amount.ToString() + " Money while opening the TreasureBox!", Color.Red, Message.System));
break;
}
case ITEMS:
{
Database.ConquerItemBaseInformation temp;
uint itemid = (uint)Kernel.RandFromGivingNums(3001045, 3001044, 3004123, 3004249, 3004247, 3004248, 3300810, 3009001, 3009002, 192935, 193015, 193565, 193765, 193625, 193685, 200107, 200203);
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.Red, Message.System));
break;
}
case KICK:
{
client.Player.Teleport(1002, 301, 278);
Kernel.SendWorldMessage(new Message(client.Player.Name + " got KICKED-OUT! while opening the TreasureBox!", Color.Red, Message.System));
break;
}
}
}
CurrentBoxes--;
client.Player.TreasuerPoints += 1;
}
}
}
|
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
اضافه حرب ClanWar لمن يعاني في مشاكل عنده | Hassan Emprator | تطوير سيرفرات كونكر | 6 | 2024-09-22 04:23 PM |
والي عنده ارينا زيينا نقوله يا عمنا | midoazoz | تطوير سيرفرات كونكر | 43 | 2024-04-19 11:56 AM |
سيستم كوستة وحوش يوميه كوستت Code Winner | M.H.B[X-Coder]X | تطوير سيرفرات كونكر | 29 | 2024-03-23 12:34 AM |
عاوز اعمل رنك لموسابقه الصناديق يقول فيها جمع كام سبس | سمير | مشكلات السيرفيرات كونكر الشخصيه | 5 | 2023-10-11 09:41 PM |
عندي مشكلتين لو حد عنده حل ياريت يفدني | Mr NemNem | مشكلات السيرفيرات كونكر الشخصيه | 0 | 2021-09-06 03:13 PM |