|
المشاركات 1,941 |
+التقييم 0.96 |
تاريخ التسجيل Apr 2019 |
الاقامة Egypt |
نظام التشغيل windows 7 |
رقم العضوية 1 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Generic;
using Conquer_Online_Server.Game;
using Conquer_Online_Server.Database;
using Conquer_Online_Server.Network.GamePackets;
using System.Drawing;
using Conquer_Online_Server.Client;
namespace Conquer_Online_Server
{
class FindGm
{
static ushort Mapid = (ushort)Kernel.RandFromGivingNums(1036);
static Map Map = Kernel.Maps[Mapid];
const int ITEMS = 1000, CPSMoney = 1001;
//static int CurrentBoxes = 0;
public static Conquer_Online_Server.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 (Map != null)
{
if (npc != null)
{
Map.RemoveNpc(npc);
}
}
Mapid = (ushort)Kernel.RandFromGivingNums(1036);
Map = Kernel.Maps[Mapid];
Caspr:
var cord = Map.RandomCoordinates();
tempX = cord.Item1;
tempY = cord.Item2;
if (Map.Floor[tempX, tempY, MapObjectType.Item, null])
{
npc = new Network.GamePackets.NpcSpawn();
npc.UID = Map.EntityUIDCounter.Next;
npc.Mesh = (ushort)Kernel.RandFromGivingNums(29686);
npc.Type = Enums.NpcType.Talker;
npc.MapID = Map.ID;
npc.X = tempX;
npc.Y = tempY;
npc.Name = "YouFindMe";
Map.AddNpc(npc);
//CurrentBoxes++;
Kernel.SendWorldMessage(new Message("[Quest GM] Find GM in Map" + ((Enums.Maps)Mapid).ToString(), Color.Red, Message.Service));
Console.WriteLine(npc.Name + " has shown up in " + ((Enums.Maps)npc.MapID).ToString() + " (" + npc.X + ", " + npc.Y + ")");
}
else goto Caspr;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
public static void Reward(GameClient client)
{
int prize = Kernel.RandFromGivingNums(ITEMS, CPSMoney);
//#warning TREASURE BOX PRIZE
switch (prize)
{
default:
case CPSMoney:
{//Conan
uint amount = (uint)Kernel.RandFromGivingNums(5000000, 10000000, 9000000, 7000000);
client.Entity.ConquerPoints += amount;
Kernel.SendWorldMessage(new Message(client.Entity.Name + " got " + amount + " CPs while Find GM " + ((Enums.Maps)Mapid).ToString(), Color.White, Message.Talk));
break;
}
case ITEMS:
{
// Database.ConquerItemBaseInformation temp;
uint itemid = (uint)Kernel.RandFromGivingNums(727317, 729122, 3004247, 3004249, 3004248, 3005892, 3005891);
client.Inventory.Add(itemid, 0, 1);
//Database.ConquerItemInformation.BaseInformations.TryGetValue(itemid, out temp);
Kernel.SendWorldMessage(new Message(client.Entity.Name + " Got " + ITEMS + " while Find GM " + ((Enums.Maps)Mapid).ToString(), Color.White, Message.BroadcastMessage));
break;
}
}
//CurrentBoxes--;
// client.Entity.ConquerPoints += 1000;
// client.Entity.TreasuerPoints += 1;
}
}
}
if (client.ActiveNpc >= 101002 && client.Entity.MapID == 10002)
if (FindGm.npc != null)
if (client.ActiveNpc == FindGm.npc.UID)
{
client.SendScreen(new Network.GamePackets.Data(true) { UID = client.ActiveNpc, ID = Network.GamePackets.Data.RemoveEntity }, true);
client.Map.RemoveNpc(client.Map.Npcs[client.ActiveNpc]);
FindGm.Reward(client);
}
#region FindGm
if (Now64.Minute == 25 && Now64.Second == 0)
{
FindGm.Generate();
}
#endregion
var cord = Map.RandomCoordinates();
var cord = Map.RandomCoordinates();
tempX = cord.Item1;
tempY = cord.Item2;
tempX = (ushort)Kernel.Random.Next(0, Map.Floor.Bounds.Width);
tempY = (ushort)Kernel.Random.Next(0, Map.Floor.Bounds.Height);