You last visited: Today at 15:28
Advertisement
Help With Commands Once Again.
Discussion on Help With Commands Once Again. within the CO2 Private Server forum part of the Conquer Online 2 category.
03/01/2010, 22:38
#1
elite*gold: 0
Join Date: Apr 2007
Posts: 142
Received Thanks: 15
Help With Commands Once Again.
Okay.. So This is weird. Like /recall playername worked when I used it on my computer, but when I went on hoster pc, installed it there and had to do that 86x bit thing... Then I put it online.. Now I cant do /recall playername but I can do /recall all, but other GM/PM's can't do nothing x.x Just wondering does this error got something to do with it.
But Like It Works Perfectly before I moved it to hoster and forced it to make it 86x bit to make it work. And Yes I Did First Build And Then Debug. I just Don't know what's wrong with it.
Code:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.IO;
namespace NewestCOServer.PacketHandling
{
public class Chat
{
public static void Handle(Main.GameClient GC, byte[] Data)
{
MemoryStream MS = new MemoryStream(Data);
BinaryReader BR = new BinaryReader(MS);
BR.ReadBytes(8);
ushort ChatType = (ushort)BR.ReadUInt32();
BR.ReadBytes(13);
string From = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
string To = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
BR.ReadByte();
string Message = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
BR.Close();
MS.Close();
#region BadWords
Message = Message.Replace("damn", "****");
Message = Message.Replace("fuck", "****");
Message = Message.Replace("shit", "****");
Message = Message.Replace("stupid", "******");
Message = Message.Replace("wtf", "***");
Message = Message.Replace("idiot", "*****");
Message = Message.Replace("fucker", "******");
#endregion
if (ChatType == 2104 && GC.MyChar.MyShop != null)
GC.MyChar.MyShop.Hawk = Message;
try
{
if (Message[0] == '/')
{
string[] Cmd = Message.Split(' ');
if (Cmd[0] == "/dc")
{
GC.Disconnect();
return;
}
if (Cmd[0] == "/players")
{
GC.LocalMessage(2000, "Players Online: " + Game.World.H_Chars.Count);
string eMsg = "";
foreach (Game.Character C in Game.World.H_Chars.Values)
eMsg += C.Name + ", ";
if (eMsg.Length > 1)
eMsg = eMsg.Remove(eMsg.Length - 2, 2);
GC.LocalMessage(2000, eMsg);
}
if (Cmd[0] == "/forcerevive")
{
if (!GC.MyChar.Alive)
{
if (DateTime.Now > GC.MyChar.DeathHit.AddSeconds(20))
{
GC.MyChar.Ghost = false;
GC.MyChar.BlueName = false;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
GC.MyChar.Alive = true;
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.Dead);
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.BlueName);
GC.MyChar.Body = GC.MyChar.Body;
GC.MyChar.Hair = GC.MyChar.Hair;
GC.MyChar.Equips.Send(GC, false);
if (GC.MyChar.Loc.Map == 1038 && Features.GuildWars.War)
GC.MyChar.Teleport(6001, 32, 72);
else
{
if (GC.MyChar.PKPoints >= 100)
GC.MyChar.Teleport(6000, 32, 72);
else
{
foreach (ushort[] Point in Database.RevPoints)
if (Point[0] == GC.MyChar.Loc.Map)
{
GC.MyChar.Teleport(Point[1], Point[2], Point[3]);
break;
}
}
}
}
}
}
if (Cmd[0] == "/makehouse")
{
ushort staticmapid = 1098;
ushort genmapid = 10000;
bool Success = DMaps.CreateDynamicMap(genmapid, staticmapid, GC.MyChar.EntityID);
if (!Success)
GC.LocalMessage(2000, "You already have a house.");
else
DMaps.Save();
}
if (Cmd[0] == "/home")
{
ushort HouseId = DMaps.GetHouseID(GC.MyChar.EntityID);
if (HouseId > 0)
{
ushort House_x = 33;
ushort House_y = 40;
if (DMaps.HouseUpgrade(HouseId))
{
House_x = 51;
House_y = 80;
}
GC.MyChar.Teleport(HouseId, House_x, House_y);
}
else
GC.LocalMessage(2000, "You do not have a house.");
}
if (Cmd[0] == "/upgradehouse")
{
ushort stmapid = 1099;
ushort gmapid = 10000;
ushort HId = DMaps.GetHouseID(GC.MyChar.EntityID);
if (HId > 0)
{
bool OK = DMaps.DeleteDynamicMap(HId, GC.MyChar.EntityID);
if (OK)
{
OK = DMaps.CreateDynamicMap(gmapid, stmapid, GC.MyChar.EntityID);
if (!OK)
GC.LocalMessage(2000, "You already have an upgraded house.");
else
DMaps.Save();
}
}
else
GC.LocalMessage(2000, "You do not have a house.");
}
if (Cmd[0] == "/awardtoptrojan")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopTrojan);
#endregion
if (Cmd[0] == "/awardtopwarrior")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopWarrior);
#endregion
if (Cmd[0] == "/awardtopninja")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopNinja);
#endregion
if (Cmd[0] == "/awardtoparcher")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopArcher);
#endregion
if (Cmd[0] == "/awardtopfiretaoist")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopFireTaoist);
#endregion
if (Cmd[0] == "/awardtopwatertaoist")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopWaterTaoist);
#endregion
if (Cmd[0] == "/awardweeklypkchampion")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.WeeklyPKChampion);
#endregion
if (Cmd[0] == "/awardtopguildleader")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopGuildLeader);
#endregion
if (Cmd[0] == "/awardtopdeputyleader")
#region Players
foreach (Game.Character Player in Game.World.H_Chars.Values)
Player.StatEff.Add(NewestCOServer.Game.StatusEffectEn.TopDeputyLeader);
#endregion
else if (Cmd[0] == "/pkt")
{
if (GC.GM)
{
if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
{
NewestCOServer.Features.PKTournament.StartTournament();
Console.WriteLine("PK Tournament started!");
}
else
{
Console.WriteLine("PK Tournament is already in progress!");
}
}
}
if (Cmd[0] == "/rev")
{
if (!GC.MyChar.Alive)
{
if (DateTime.Now > GC.MyChar.DeathHit.AddSeconds(0))
{
if (GC.MyChar.BlessingLasts > 0)
{
GC.MyChar.Ghost = false;
GC.MyChar.BlueName = false;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
GC.MyChar.Alive = true;
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.Dead);
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.BlueName);
GC.MyChar.Body = GC.MyChar.Body;
GC.MyChar.Hair = GC.MyChar.Hair;
GC.MyChar.Equips.Send(GC, false);
if (GC.MyChar.Loc.Map == 1038)
if (Features.GuildWars.War)
{
GC.LocalMessage(2005, "You cant revive here while guild war is on.");
}
else
{
GC.MyChar.Teleport(GC.MyChar.Loc.Map, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
}
}
}
}
}
if (Cmd[0] == "/model")
{
if (Cmd[1] == "smale")
GC.MyChar.Body = 1003;
else if (Cmd[1] == "lmale")
GC.MyChar.Body = 1004;
else if (Cmd[1] == "sfemale")
GC.MyChar.Body = 2001;
else if (Cmd[1] == "lfemale")
GC.MyChar.Body = 2002;
}
if (Cmd[0] == "/sandraider")
{
GC.MyChar.AddItem(183305 - 12 - 7 - 255 - 13 - 13);//SandRaider
}
if (Cmd[0] == "/nin")
{
GC.MyChar.AddItem(123109 - 12 - 7 - 255 - 13 - 13);//Head Gear
GC.MyChar.AddItem(601339 - 12 - 7 - 255 - 13 - 13);//Katana
GC.MyChar.AddItem(601339 - 12 - 7 - 255 - 13 - 13);//Katana
GC.MyChar.AddItem(120249 - 12 - 7 - 255 - 13 - 13);//Necklace
GC.MyChar.AddItem(150249 - 12 - 7 - 255 - 13 - 13);//Ring
GC.MyChar.AddItem(160249 - 12 - 7 - 255 - 13 - 13);//Boots
GC.MyChar.AddItem(135109 - 12 - 7 - 255 - 13 - 13);//Armor
GC.MyChar.AddItem(201009 - 12 - 1 - 0 - 123 - 123);//HeavenFan
GC.MyChar.AddItem(202009 - 12 - 1 - 0 - 103 - 103);//StarTower
}
if (Cmd[0] == "/tro")
{
GC.MyChar.AddItem(118109 - 12 - 7 - 255 - 13 - 13);//Head Gear
GC.MyChar.AddItem(480339 - 12 - 7 - 255 - 13 - 13);//Club
GC.MyChar.AddItem(410339 - 12 - 7 - 255 - 13 - 13);//Blade
GC.MyChar.AddItem(420339 - 12 - 7 - 255 - 13 - 13);//Sword
GC.MyChar.AddItem(120249 - 12 - 7 - 255 - 13 - 13);//Necklace
GC.MyChar.AddItem(150249 - 12 - 7 - 255 - 13 - 13);//Ring
GC.MyChar.AddItem(160249 - 12 - 7 - 255 - 13 - 13);//Boots
GC.MyChar.AddItem(130109 - 12 - 7 - 255 - 13 - 13);//Armor
GC.MyChar.AddItem(201009 - 12 - 1 - 0 - 123 - 123);//HeavenFan
GC.MyChar.AddItem(202009 - 12 - 1 - 0 - 103 - 103);//StarTower
}
if (Cmd[0] == "/war")
{
GC.MyChar.AddItem(141109 - 12 - 7 - 255 - 13 - 13);//Head Gear
GC.MyChar.AddItem(480339 - 12 - 7 - 255 - 13 - 13);//Club
GC.MyChar.AddItem(410339 - 12 - 7 - 255 - 13 - 13);//Blade
GC.MyChar.AddItem(420339 - 12 - 7 - 255 - 13 - 13);//Sword
GC.MyChar.AddItem(900109 - 12 - 7 - 255 - 13 - 13);//Shield
GC.MyChar.AddItem(120249 - 12 - 7 - 255 - 13 - 13);//Necklace
GC.MyChar.AddItem(150249 - 12 - 7 - 255 - 13 - 13);//Ring
GC.MyChar.AddItem(160249 - 12 - 7 - 255 - 13 - 13);//Boots
GC.MyChar.AddItem(131109 - 12 - 7 - 255 - 13 - 13);//Armor
GC.MyChar.AddItem(201009 - 12 - 1 - 0 - 123 - 123);//HeavenFan
GC.MyChar.AddItem(202009 - 12 - 1 - 0 - 103 - 103);//StarTower
}
if (Cmd[0] == "/arch")
{
GC.MyChar.AddItem(142109 - 12 - 7 - 255 - 13 - 13);//Head Gear
GC.MyChar.AddItem(500329 - 12 - 7 - 255 - 13 - 13);//Bow
GC.MyChar.AddItem(120249 - 12 - 7 - 255 - 13 - 13);//Necklace
GC.MyChar.AddItem(150249 - 12 - 7 - 255 - 13 - 13);//Ring
GC.MyChar.AddItem(160249 - 12 - 7 - 255 - 13 - 13);//Boots
GC.MyChar.AddItem(133109 - 12 - 7 - 255 - 13 - 13);//Armor
GC.MyChar.AddItem(201009 - 12 - 1 - 0 - 123 - 123);//HeavenFan
GC.MyChar.AddItem(202009 - 12 - 1 - 0 - 103 - 103);//StarTower
}
if (Cmd[0] == "/tao")
{
GC.MyChar.AddItem(114109 - 12 - 7 - 255 - 3 - 3);//Head Gear
GC.MyChar.AddItem(421339 - 12 - 7 - 255 - 3 - 3);//BackSword
GC.MyChar.AddItem(120249 - 12 - 7 - 255 - 3 - 3);//Necklace
GC.MyChar.AddItem(150249 - 12 - 7 - 255 - 3 - 3);//Ring
GC.MyChar.AddItem(160249 - 12 - 7 - 255 - 3 - 3);//Boots
GC.MyChar.AddItem(134109 - 12 - 7 - 255 - 3 - 3);//Armor
GC.MyChar.AddItem(201009 - 12 - 1 - 0 - 123 - 123);//HeavenFan
GC.MyChar.AddItem(202009 - 12 - 1 - 0 - 103 - 103);//StarTower
}
if (Cmd[0] == "/weapons")
{
GC.MyChar.AddItem(601339 - 12 - 7 - 255 - 13 - 13);//Katana
GC.MyChar.AddItem(421339 - 12 - 7 - 255 - 3 - 3);//BackSword
GC.MyChar.AddItem(500329 - 12 - 7 - 255 - 13 - 13);//Bow
GC.MyChar.AddItem(480339 - 12 - 7 - 255 - 13 - 13);//Club
GC.MyChar.AddItem(410339 - 12 - 7 - 255 - 13 - 13);//Blade
GC.MyChar.AddItem(420339 - 12 - 7 - 255 - 13 - 13);//Sword
GC.MyChar.AddItem(490339 - 12 - 7 - 255 - 13 - 13);//Dagger
GC.MyChar.AddItem(430339 - 12 - 7 - 255 - 13 - 13);//Hook
GC.MyChar.AddItem(450339 - 12 - 7 - 255 - 13 - 13);//Axe
GC.MyChar.AddItem(460339 - 12 - 7 - 255 - 13 - 13);//Hammer
GC.MyChar.AddItem(440339 - 12 - 7 - 255 - 13 - 13);//Whip
GC.MyChar.AddItem(481339 - 12 - 7 - 255 - 13 - 13);//Scepter
GC.MyChar.AddItem(560339 - 12 - 7 - 255 - 13 - 13);//Spear
GC.MyChar.AddItem(561339 - 12 - 7 - 255 - 13 - 13);//Wand
GC.MyChar.AddItem(510339 - 12 - 7 - 255 - 13 - 13);//Glaive
GC.MyChar.AddItem(530339 - 12 - 7 - 255 - 13 - 13);//Poleaxe
GC.MyChar.AddItem(580339 - 12 - 7 - 255 - 13 - 13);//Halbert
}
if (Cmd[0] == "/stats")
{
GC.MyChar.Str = +1000;
GC.MyChar.Agi = +1000;
GC.MyChar.Spi = +1000;
GC.MyChar.Vit = +1000;
}
if (Cmd[0] == "/mana")
GC.MyChar.CurMP = (ushort)GC.MyChar.MaxMP;
if (Cmd[0] == "/life")
{
if (GC.MyChar.BlessingLasts == 0)
{
GC.MyChar.CurHP = /*(ushort)*/GC.MyChar.MaxHP;
GC.MyChar.CurMP = /*(ushort)*/GC.MyChar.MaxMP;
GC.MyChar.Stamina = 100;
}
else
{
GC.MyChar.CurHP = /*(ushort)*/GC.MyChar.MaxHP;
GC.MyChar.CurMP = /*(ushort)*/GC.MyChar.MaxMP;
GC.MyChar.Stamina = 150;
}
}
if (Cmd[0] == "/tc")
{
GC.MyChar.Teleport(1002, 429, 378);
}
if (Cmd[0] == "/sc")
{
GC.MyChar.Teleport(1077, 435, 337);
}
if (Cmd[0] == "/house")
{
GC.MyChar.Teleport(1099, 44, 40);
}
if (Cmd[0] == "/moon")
{
GC.MyChar.Teleport(1100, 077, 059);
}
if (Cmd[0] == "/love")
{
GC.MyChar.Teleport(1615, 20, 20);
}
if (Cmd[0] == "/sky")
{
GC.MyChar.Teleport(1040, 392, 565);
}
if (Cmd[0] == "/bv")
{
GC.MyChar.Teleport(1010, 89, 53);
}
if (Cmd[0] == "/ma")
{
GC.MyChar.Teleport(1036, 211, 196);
}
if (Cmd[0] == "/vip")
{
GC.MyChar.Teleport(1511, 51, 66);
}
if (Cmd[0] == "/pc")
{
GC.MyChar.Teleport(1011, 232, 260);
}
if (Cmd[0] == "/pka")
{
GC.MyChar.Teleport(1005, 51, 51);
}
if (Cmd[0] == "/bi")
{
GC.MyChar.Teleport(1015, 717, 576);
}
if (Cmd[0] == "/des")
{
GC.MyChar.Teleport(1000, 499, 650);
}
if (Cmd[0] == "/am")
{
GC.MyChar.Teleport(1020, 567, 568);
}
if (Cmd[0] == "/gwp")
{
GC.MyChar.Teleport(1038, 088, 102);
}
if (Cmd[0] == "/jail")
{
GC.MyChar.Teleport(6000, 032, 072);
}
if (Cmd[0] == "/revivehere" || Cmd[0] == "/rh")
{
if (!GC.MyChar.Alive)
{
if (DateTime.Now > GC.MyChar.DeathHit.AddSeconds(20))
{
if (GC.MyChar.BlessingLasts > 0)
{
GC.MyChar.Ghost = false;
GC.MyChar.BlueName = false;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
GC.MyChar.Alive = true;
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.Dead);
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.BlueName);
GC.MyChar.Body = GC.MyChar.Body;
GC.MyChar.Hair = GC.MyChar.Hair;
GC.MyChar.Equips.Send(GC, false);
if (GC.MyChar.Loc.Map == 1038)
if (Features.GuildWars.War)
{
GC.LocalMessage(2005, "You cant revive here while guild war is on.");
}
else
{
GC.MyChar.Teleport(GC.MyChar.Loc.Map, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
}
}
}
}
}
else if (GC.MyChar.Loc.Map == 1730)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here while TopPkTrojan run.");
}
else if (GC.MyChar.Loc.Map == 1731)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here while TopPkWarrior run.");
}
else if (GC.MyChar.Loc.Map == 1732)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here while TopPkNinja run.");
}
else if (GC.MyChar.Loc.Map == 1733)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here while TopPkTaroistWater run.");
}
else if (GC.MyChar.Loc.Map == 1734)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here while TopPkFireWater run.");
}
else if (GC.MyChar.Loc.Map == 1735)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here while TopPkArcher run.");
}
else if (GC.MyChar.Loc.Map == 1736)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here.");
}
else if (GC.MyChar.Loc.Map == 1737)
{
GC.MyChar.Teleport(1002, 429, 378);
GC.LocalMessage(2005, "You cant revive here while WeeklyPKChampion run.");
}
if (GC.AuthInfo.Status == "[GM]" || GC.AuthInfo.Status == "[PM]")
{
if (GC.AuthInfo.Status == "[PM]")
{
if (Cmd[0] == "/day")
{
Game.World.ScreenColor = 0;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
GC.LocalMessage(2011, "Day has arrived. Good morning everyone");
}
catch { }
}
if (Cmd[0] == "/night")
{
Game.World.ScreenColor = 5855577;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
GC.LocalMessage(2011,"Night has arrived. Good night everyone ");
}
catch { }
}
if (Cmd[0] == "/night1")
{
Game.World.ScreenColor = 5355577;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
}
catch { }
}
if (Cmd[0] == "/night2")
{
Game.World.ScreenColor = 6908265;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
}
catch { }
}
}
if (GC.AuthInfo.Status == "[PM]")
{
if (Cmd[0] == "/closeserver")
{
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.LogOff(true);
}
catch { continue; }
Database.SaveKOs();
Features.Guilds.SaveGuilds();
DMaps.Save();
DMaps.Save();
Features.SkillsClass.Save();
Environment.Exit(0);
System.Diagnostics.Process.Start("NewestCOServer.exe");
}
if (Cmd[0] == "/restart")
{
NewestCOServer.Main.AuthWorker.Listener.Close();
NewestCOServer.Main.GameWorker.Listener.Close();
try
{
foreach (Game.Character C in Game.World.H_Chars.Values)
{
try
{
C.MyClient.Disconnect();
Console.WriteLine(C.Name + " has logged off successfuly.");
}
catch { continue; }
}
}
catch { }
Database.SaveKOs();
Console.WriteLine("KOs saved.");
Database.SaveEmpire();
Console.WriteLine("Empire saved.");
Features.Guilds.SaveGuilds();
Console.WriteLine("Guilds saved.");
DMaps.Save();
DMaps.Save();
DMaps.Save();
Features.SkillsClass.Save();
Console.WriteLine("Skills saved.");
Console.WriteLine("Database disposed.");
Console.WriteLine("Write /exit or click X to close the window.");
System.Diagnostics.Process.Start("NewestCOServer.exe");
Environment.Exit(0);
}
if (Cmd[0] == "/lucky")
GC.LocalMessage(2000, "Lucky time: " + GC.MyChar.LuckyTime);
if (Cmd[0] == "/dropevent")
{
try
{
if (Program.DropEventTimer == null)
{
bool start = true;
if (Cmd[1].ToLower() == "dragonball")
{
Program.DropEventType = "dragonball";
Program.SaveOldRate = DropRates.DragonBall;
DropRates.DragonBall = (DropRates.DragonBall * int.Parse(Cmd[3]));
}
else if (Cmd[1].ToLower() == "meteor")
{
Program.DropEventType = "meteor";
Program.SaveOldRate = DropRates.Meteor;
DropRates.Meteor = (DropRates.Meteor * int.Parse(Cmd[3]));
}
else if (Cmd[1].ToLower() == "minicpbag")
{
Program.DropEventType = "minicpbag";
Program.SaveOldRate = DropRates.CPMiniBag;
DropRates.CPMiniBag = (DropRates.CPMiniBag == 0 ? 1 : DropRates.CPMiniBag * int.Parse(Cmd[3]));
}
else if (Cmd[1].ToLower() == "cpbag")
{
Program.DropEventType = "cpbag";
Program.SaveOldRate = DropRates.CPBag;
DropRates.CPBag = (DropRates.CPBag == 0 ? 1 : DropRates.CPBag * int.Parse(Cmd[3]));
}
else
start = false;
if (start)
{
Program.DropEventTimer = new System.Timers.Timer();
Program.DropEventTimer.Interval = (int.Parse(Cmd[2]) * 60000);
Program.DropEventTimer.Elapsed += new System.Timers.ElapsedEventHandler(Program.QuestDropDone);
Program.DropEventTimer.Start();
Game.World.SendMsgToAll("Server", "[Event] Server will drop " + Cmd[1] + "s " + Cmd[3] + "x for " + Cmd[2] + " minutes.", 2011, 0);
}
else
GC.LocalMessage(2001, "Item name is not a dropevent!");
}
else
GC.LocalMessage(2001, "There is a running event, you must wait it end to start a new!");
}
catch { GC.LocalMessage(2001, "Wrongs values!"); GC.LocalMessage(2001, "Format: /questdrop ItemName Minutes Timers"); GC.LocalMessage(2001, "Example: /questdrop dragonball 15 1000 its in up the rates to 1000x in 15 minutos."); }
}
if (Cmd[0] == "/itemtest")
{
Game.Item I = new NewestCOServer.Game.Item();
I.Effect = NewestCOServer.Game.Item.RebornEffect.Shield;
I.ID = 410329;
I.Plus = 12;
I.Soc1 = NewestCOServer.Game.Item.Gem.SuperDragonGem;
I.Soc2 = NewestCOServer.Game.Item.Gem.SuperRainbowGem;
I.Bless = 5;
I.Enchant = 200;
I.UID = (uint)Program.Rnd.Next(10000000);
GC.AddSend(Packets.AddItem(I, 0));
}
if (Cmd[0] == "/drop")
{
uint DropID = 0;
Random Rnd = new Random();
string DropWhat = Cmd[1].ToLower();
byte HowMany = (byte)Math.Min(ushort.Parse(Cmd[2]), (ushort)255);
switch (DropWhat)
{
case "dragonball": DropID = 1088000; break;
case "meteor": DropID = 1088001; break;
case "pointcard": DropID = 780000; break;
case "moonbox": DropID = 721080; break;
case "bag": DropID = 729910; break;
case "ball": DropID = 723834; break;
}
Game.DroppedItem DI = new Game.DroppedItem();
DI.DropTime = DateTime.Now;
DI.UID = (uint)Rnd.Next(10000000);
DI.Loc = new Game.Location();
DI.Loc.Map = GC.MyChar.Loc.Map;
DI.Info = new Game.Item();
DI.Info.ID = DropID;
DI.Info.UID = (uint)Rnd.Next(10000000);
for (int x = 0; x < HowMany; x++)
{
DI.Loc.X = (ushort)(GC.MyChar.Loc.X + Rnd.Next(15) - Rnd.Next(15));
DI.Loc.Y = (ushort)(GC.MyChar.Loc.Y + Rnd.Next(15) - Rnd.Next(15));
if (!DI.FindPlace((Hashtable)Game.World.H_Items[GC.MyChar.Loc.Map])) continue;
DI.Drop();
}
}
if (Cmd[0] == "/robot")
{
string Account = "";
string Name = Cmd[1];
if (Game.World.CharacterFromName(Name) == null)
{
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
}
}
if (Cmd[0] == "/robot1")
{
string Account = "";
string Name = Cmd[1];
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
if (Cmd[0] == "/reborn")
{
GC.MyChar.Reborns = byte.Parse(Cmd[1]);
}
if (Cmd[0] == "/gw" && !Features.GuildWars.War)
Features.GuildWars.StartWar();
if (Cmd[0] == "/gems")
{
if (GC.MyChar.Inventory.Count <= 32)
{
GC.MyChar.AddItem(700001);
GC.MyChar.AddItem(700011);
GC.MyChar.AddItem(700021);
GC.MyChar.AddItem(700031);
GC.MyChar.AddItem(700041);
GC.MyChar.AddItem(700051);
GC.MyChar.AddItem(700061);
GC.MyChar.AddItem(700071);
GC.MyChar.AddItem(700101);
GC.MyChar.AddItem(700121);
}
}
if (Cmd[0] == "/eqlow")
{
for (byte i = 1; i < 9; i++)
if (i != 7)
{
Game.Item I = GC.MyChar.Equips.Get(i);
if (I.ID != 0)
{
Game.ItemIDManipulation IDM = new NewestCOServer.Game.ItemIDManipulation(I.ID);
IDM.LowestLevel(i);
I.ID = IDM.ToID();
GC.AddSend(Packets.AddItem(I, i));
}
}
}
if (Cmd[0] == "/allskills")
{
GC.MyChar.RWSkill(new Game.Skill() { ID = 1045, Lvl = 4, Exp = 0 }); // Fast Blade (Blade)
GC.MyChar.RWSkill(new Game.Skill() { ID = 6003, Lvl = 4, Exp = 0 }); //Counter-Kill
GC.MyChar.RWSkill(new Game.Skill() { ID = 1046, Lvl = 4, Exp = 0 }); // Scent Sword (Sword)
GC.MyChar.RWSkill(new Game.Skill() { ID = 5030, Lvl = 9, Exp = 0 }); // Phoenix (Sword)
GC.MyChar.RWSkill(new Game.Skill() { ID = 7020, Lvl = 9, Exp = 0 }); // Rage (Club)
GC.MyChar.RWSkill(new Game.Skill() { ID = 7030, Lvl = 9, Exp = 0 }); // Celestial (scepter)
GC.MyChar.RWSkill(new Game.Skill() { ID = 1290, Lvl = 9, Exp = 0 }); // Penetration (dagger)
GC.MyChar.RWSkill(new Game.Skill() { ID = 7000, Lvl = 9, Exp = 0 }); // Seizer (hook)
GC.MyChar.RWSkill(new Game.Skill() { ID = 7010, Lvl = 9, Exp = 0 }); // Earthquake (axe)
GC.MyChar.RWSkill(new Game.Skill() { ID = 7040, Lvl = 9, Exp = 0 }); // Roamer (whip)
GC.MyChar.RWSkill(new Game.Skill() { ID = 5040, Lvl = 9, Exp = 0 }); // Boom (hammer)
GC.MyChar.RWSkill(new Game.Skill() { ID = 1115, Lvl = 4, Exp = 0 }); // Hercules
GC.MyChar.RWSkill(new Game.Skill() { ID = 1051, Lvl = 0, Exp = 0 }); // Dash (shield)
GC.MyChar.RWSkill(new Game.Skill() { ID = 6000, Lvl = 4, Exp = 0 }); // TwinFoldBlades (katana)
GC.MyChar.RWSkill(new Game.Skill() { ID = 1260, Lvl = 9, Exp = 0 }); // SpeedGun (spear)
GC.MyChar.RWSkill(new Game.Skill() { ID = 1250, Lvl = 9, Exp = 0 }); // WideStrike (glaive)
GC.MyChar.RWSkill(new Game.Skill() { ID = 1300, Lvl = 9, Exp = 0 }); // Halt (longhammer)
GC.MyChar.RWSkill(new Game.Skill() { ID = 5010, Lvl = 9, Exp = 0 }); // Snow (wand)
GC.MyChar.RWSkill(new Game.Skill() { ID = 5020, Lvl = 9, Exp = 0 }); // StrandedMonster (halberd)
GC.MyChar.RWSkill(new Game.Skill() { ID = 5050, Lvl = 9, Exp = 0 }); // Boreas (poleaxe)
GC.MyChar.RWSkill(new Game.Skill() { ID = 1195, Lvl = 2, Exp = 0 }); // Meditation
GC.MyChar.RWSkill(new Game.Skill() { ID = 1100, Lvl = 0, Exp = 0 }); // Pray/Revive
GC.MyChar.RWSkill(new Game.Skill() { ID = 1002, Lvl = 3, Exp = 0 }); // Tornado
GC.MyChar.RWSkill(new Game.Skill() { ID = 1175, Lvl = 4, Exp = 0 }); // AdvancedCure
GC.MyChar.RWSkill(new Game.Skill() { ID = 1000, Lvl = 4, Exp = 0 }); // Thunder
GC.MyChar.RWSkill(new Game.Skill() { ID = 1001, Lvl = 3, Exp = 0 }); // Fire
GC.MyChar.RWSkill(new Game.Skill() { ID = 1005, Lvl = 4, Exp = 0 }); // Cure
GC.MyChar.RWSkill(new Game.Skill() { ID = 1015, Lvl = 4, Exp = 0 }); // Accuracy
GC.MyChar.RWSkill(new Game.Skill() { ID = 1055, Lvl = 4, Exp = 0 }); // HealingRain
GC.MyChar.RWSkill(new Game.Skill() { ID = 1075, Lvl = 4, Exp = 0 }); // Invisibility
GC.MyChar.RWSkill(new Game.Skill() { ID = 1085, Lvl = 4, Exp = 0 }); // StarofAccuracy
GC.MyChar.RWSkill(new Game.Skill() { ID = 1090, Lvl = 4, Exp = 0 }); // MagicShield
GC.MyChar.RWSkill(new Game.Skill() { ID = 1095, Lvl = 4, Exp = 0 }); // Stigma
GC.MyChar.RWSkill(new Game.Skill() { ID = 1120, Lvl = 3, Exp = 0 }); // FireCircle
GC.MyChar.RWSkill(new Game.Skill() { ID = 1125, Lvl = 3, Exp = 0 }); // Volcano
GC.MyChar.RWSkill(new Game.Skill() { ID = 1150, Lvl = 7, Exp = 0 }); // FireBall/FireRing
GC.MyChar.RWSkill(new Game.Skill() { ID = 1160, Lvl = 3, Exp = 0 }); // Bomb
GC.MyChar.RWSkill(new Game.Skill() { ID = 1165, Lvl = 3, Exp = 0 }); // FireofHell
GC.MyChar.RWSkill(new Game.Skill() { ID = 1170, Lvl = 4, Exp = 0 }); // Nectar
GC.MyChar.RWSkill(new Game.Skill() { ID = 1180, Lvl = 7, Exp = 0 }); // FireMeteor
GC.MyChar.RWSkill(new Game.Skill() { ID = 1190, Lvl = 2, Exp = 0 }); // SpiritHealing
GC.MyChar.RWSkill(new Game.Skill() { ID = 3090, Lvl = 5, Exp = 0 }); // Pervade
GC.MyChar.RWSkill(new Game.Skill() { ID = 8000, Lvl = 5, Exp = 0 }); // RapidFire
GC.MyChar.RWSkill(new Game.Skill() { ID = 8001, Lvl = 5, Exp = 0 }); // Scatter
GC.MyChar.RWSkill(new Game.Skill() { ID = 8002, Lvl = 0, Exp = 0 }); // XP Fly
GC.MyChar.RWSkill(new Game.Skill() { ID = 8003, Lvl = 1, Exp = 0 }); // AdvancedFly
GC.MyChar.RWSkill(new Game.Skill() { ID = 8030, Lvl = 0, Exp = 0 }); // ArrowRain
GC.MyChar.RWSkill(new Game.Skill() { ID = 9000, Lvl = 3, Exp = 0 }); // Intensify
GC.MyChar.RWSkill(new Game.Skill() { ID = 7000, Lvl = 0, Exp = 0 }); // Riding
GC.MyChar.RWSkill(new Game.Skill() { ID = 7001, Lvl = 0, Exp = 0 }); // Spook
GC.MyChar.RWSkill(new Game.Skill() { ID = 7002, Lvl = 0, Exp = 0 }); // Warcry
GC.MyChar.RWSkill(new Game.Skill() { ID = 1025, Lvl = 0, Exp = 0 }); // Superman
GC.MyChar.RWSkill(new Game.Skill() { ID = 1020, Lvl = 0, Exp = 0 }); // XP Shield
GC.MyChar.RWSkill(new Game.Skill() { ID = 1110, Lvl = 0, Exp = 0 }); // Cyclone
GC.MyChar.RWSkill(new Game.Skill() { ID = 1040, Lvl = 0, Exp = 0 }); // Roar
GC.MyChar.RWSkill(new Game.Skill() { ID = 1270, Lvl = 7, Exp = 0 }); // Golem
GC.MyChar.RWSkill(new Game.Skill() { ID = 1280, Lvl = 8, Exp = 0 }); // WaterElf
GC.MyChar.RWSkill(new Game.Skill() { ID = 1350, Lvl = 4, Exp = 0 }); // DivineHare
GC.MyChar.RWSkill(new Game.Skill() { ID = 1360, Lvl = 4, Exp = 0 }); // NightDevil
GC.MyChar.RWSkill(new Game.Skill() { ID = 1320, Lvl = 2, Exp = 0 }); // FlyingMoon
GC.MyChar.RWSkill(new Game.Skill() { ID = 1010, Lvl = 0, Exp = 0 }); // Lightning
GC.MyChar.RWSkill(new Game.Skill() { ID = 1050, Lvl = 0, Exp = 0 }); // XP Revive
GC.MyChar.RWSkill(new Game.Skill() { ID = 5001, Lvl = 0, Exp = 0 }); // SpeedLightning
GC.MyChar.RWSkill(new Game.Skill() { ID = 4000, Lvl = 3, Exp = 0 }); // SummonGuard
GC.MyChar.RWSkill(new Game.Skill() { ID = 4010, Lvl = 0, Exp = 0 }); // SummonBat
GC.MyChar.RWSkill(new Game.Skill() { ID = 4020, Lvl = 0, Exp = 0 }); // SummonBatBoss
GC.MyChar.RWSkill(new Game.Skill() { ID = 4030, Lvl = 0, Exp = 0 }); // StandinBat
GC.MyChar.RWSkill(new Game.Skill() { ID = 4050, Lvl = 0, Exp = 0 }); // BloodyBat
GC.MyChar.RWSkill(new Game.Skill() { ID = 4060, Lvl = 0, Exp = 0 }); // FireEvil
GC.MyChar.RWSkill(new Game.Skill() { ID = 4070, Lvl = 0, Exp = 0 }); // Skeleton
GC.MyChar.RWSkill(new Game.Skill() { ID = 3050, Lvl = 0, Exp = 0 }); // CruelShade
GC.MyChar.RWSkill(new Game.Skill() { ID = 3060, Lvl = 0, Exp = 0 }); // Reflect
GC.MyChar.RWSkill(new Game.Skill() { ID = 3080, Lvl = 0, Exp = 0 }); // Dodge
GC.MyChar.RWSkill(new Game.Skill() { ID = 1380, Lvl = 0, Exp = 0 }); // Dance2
GC.MyChar.RWSkill(new Game.Skill() { ID = 1385, Lvl = 0, Exp = 0 }); // Dance3
GC.MyChar.RWSkill(new Game.Skill() { ID = 1390, Lvl = 0, Exp = 0 }); // Dance4
GC.MyChar.RWSkill(new Game.Skill() { ID = 1395, Lvl = 0, Exp = 0 }); // Dance5
GC.MyChar.RWSkill(new Game.Skill() { ID = 1400, Lvl = 0, Exp = 0 }); // Dance6
GC.MyChar.RWSkill(new Game.Skill() { ID = 1405, Lvl = 0, Exp = 0 }); // Dance7
GC.MyChar.RWSkill(new Game.Skill() { ID = 1410, Lvl = 0, Exp = 0 }); // Dance8
{
GC.AddSend(Packets.NPCSay("Congratulations, you have learned all skills.)"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(55));
GC.AddSend(Packets.NPCFinish());
}
}
if (Cmd[0] == "/allprofs")
{
GC.MyChar.RWProf(new Game.Prof() { ID = 410, Lvl = 12, Exp = 0 }); // Blade
GC.MyChar.RWProf(new Game.Prof() { ID = 420, Lvl = 12, Exp = 0 }); // Sword
GC.MyChar.RWProf(new Game.Prof() { ID = 421, Lvl = 12, Exp = 0 }); // Backsword
GC.MyChar.RWProf(new Game.Prof() { ID = 430, Lvl = 12, Exp = 0 }); // Hook
GC.MyChar.RWProf(new Game.Prof() { ID = 440, Lvl = 12, Exp = 0 }); // Whip
GC.MyChar.RWProf(new Game.Prof() { ID = 450, Lvl = 12, Exp = 0 }); // Axe
GC.MyChar.RWProf(new Game.Prof() { ID = 460, Lvl = 12, Exp = 0 }); // Hammer
GC.MyChar.RWProf(new Game.Prof() { ID = 480, Lvl = 12, Exp = 0 }); // Club
GC.MyChar.RWProf(new Game.Prof() { ID = 481, Lvl = 12, Exp = 0 }); // Scepter
GC.MyChar.RWProf(new Game.Prof() { ID = 490, Lvl = 12, Exp = 0 }); // Dagger
GC.MyChar.RWProf(new Game.Prof() { ID = 601, Lvl = 12, Exp = 0 }); // Katana
GC.MyChar.RWProf(new Game.Prof() { ID = 510, Lvl = 12, Exp = 0 }); // Glaive
GC.MyChar.RWProf(new Game.Prof() { ID = 530, Lvl = 12, Exp = 0 }); // Poleaxe
GC.MyChar.RWProf(new Game.Prof() { ID = 540, Lvl = 12, Exp = 0 }); // LongHammer
GC.MyChar.RWProf(new Game.Prof() { ID = 550, Lvl = 12, Exp = 0 }); // Scythe
GC.MyChar.RWProf(new Game.Prof() { ID = 560, Lvl = 12, Exp = 0 }); // Spear
GC.MyChar.RWProf(new Game.Prof() { ID = 562, Lvl = 12, Exp = 0 }); // Pickaxe
GC.MyChar.RWProf(new Game.Prof() { ID = 580, Lvl = 12, Exp = 0 }); // Halberd
GC.MyChar.RWProf(new Game.Prof() { ID = 561, Lvl = 12, Exp = 0 }); // Wand
GC.MyChar.RWProf(new Game.Prof() { ID = 500, Lvl = 12, Exp = 0 }); // Bow
GC.MyChar.RWProf(new Game.Prof() { ID = 900, Lvl = 12, Exp = 0 }); // Shield
GC.MyChar.RWProf(new Game.Prof() { ID = 422, Lvl = 12, Exp = 0 }); // Other
GC.MyChar.RWProf(new Game.Prof() { ID = 000, Lvl = 12, Exp = 0 }); // Boxing
{
GC.AddSend(Packets.NPCSay("Congratulations, your weapon proficiencies are all now at level 12.)"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(55));
GC.AddSend(Packets.NPCFinish());
}
}
if(Cmd[0] == "/appr")
GC.AddSend(Packets.MentorApprenticePacket(GC.MyChar.EntityID, (uint)Program.Rnd.Next(1000001, 19999999), Cmd[1], byte.Parse(Cmd[2]), 1));
if (Cmd[0] == "/effect")
GC.AddSend(Packets.String(GC.MyChar.EntityID, 10, Cmd[1]));
if (Cmd[0] == "/exp")
GC.MyChar.Experience = ulong.Parse(Cmd[1]);
if (Cmd[0] == "/pkp")
GC.MyChar.PKPoints = ushort.Parse(Cmd[1]);
if (Cmd[0] == "/atk")
GC.AddSend(Packets.AttackPacket(GC.MyChar.EntityID, GC.MyChar.EntityID, GC.MyChar.Loc.X, GC.MyChar.Loc.Y, 9999, byte.Parse(Cmd[1])));
if (Cmd[0] == "/recall")
{
if (Cmd[1] != "all")
{
if (GC.AuthInfo.Status == "[PM]")
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null && C != GC.MyChar)
C.Teleport(GC.MyChar.Loc.Map, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
}
}
else
{
foreach (Game.Character C in Game.World.H_Chars.Values)
C.Teleport(GC.MyChar.Loc.Map, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
}
}
if (Cmd[0] == "/c")
{
Game.World.SendMsgToAll(GC.MyChar.Name, GC.MyChar.Name + ": " + Message.Remove(0, 3), 2011, 0);
}
if (Cmd[0] == "/try")
{
GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID, 1, GC.MyChar.Loc.X, GC.MyChar.Loc.Y, byte.Parse(Cmd[1])));
}
if (Cmd[0] == "/steed")
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 300000;
I.Plus = byte.Parse(Cmd[1]);
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
I.Effect = NewestCOServer.Game.Item.RebornEffect.Horsie;
I.TalismanProgress = BitConverter.ToUInt32(new byte[4] {byte.Parse(Cmd[4]), byte.Parse(Cmd[3]), byte.Parse(Cmd[2]),0},0);
I.UID = (uint)Program.Rnd.Next(10000000);
GC.MyChar.AddItem(I);
}
if (Cmd[0] == "/ctele")
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null)
GC.MyChar.Teleport(C.Loc.Map, C.Loc.X, C.Loc.Y);
}
if (Cmd[0] == "/seff")
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, ulong.Parse(Cmd[1])));
if (Cmd[0] == "/vip")
{
GC.MyChar.VipLevel = byte.Parse(Cmd[1]);
GC.AddSend(Packets.ChatMessage(0, "SYSTEM", GC.MyChar.Name, "Congratulations! Your vip level is " + GC.MyChar.VipLevel +". Thank you for donating.", 2001, 0));
}
if (Cmd[0] == "/spawn")
{
if (Cmd.Length == 3)
{
GC.SpawnOnHold = !GC.SpawnOnHold;
if (GC.SpawnOnHold)
{
GC.SpawnXStart = GC.MyChar.Loc.X;
GC.SpawnYStart = GC.MyChar.Loc.Y;
GC.LocalMessage(2000, "Starting to create spawn; Spawn starts: " + GC.SpawnXStart + ", " + GC.SpawnYStart);
}
else
{
GC.LocalMessage(2000, "Ending the spawn.");
StreamWriter SW = new StreamWriter(@"C:\OldCODB\MobSpawns.txt", true);
SW.WriteLine(Cmd[1] + " " + Cmd[2] + " " + GC.MyChar.Loc.Map + " " + GC.SpawnXStart + " " + GC.SpawnYStart + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y);
SW.Flush();
SW.Close();
}
}
}
if (Cmd[0] == "/try")
GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID, 0, 0, 0, byte.Parse(Cmd[1])));
if (Cmd[0] == "/shopflag")
{
Game.NPC N = new NewestCOServer.Game.NPC(1234.ToString() + ' ' + 1080 + ' ' + 16 + ' ' + 6 + ' ' + 0 + ' ' + GC.MyChar.Loc.Map + ' ' + GC.MyChar.Loc.X + ' ' + GC.MyChar.Loc.Y);
Game.World.Spawn(N);
}
if (Cmd[0] == "/guard")
{
StreamWriter SW = new StreamWriter(@"C:\OldCODB\MobSpawns.txt", true);
SW.WriteLine(97 + " " + 1 + " " + GC.MyChar.Loc.Map + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y);
SW.Flush();
SW.Close();
}
if (Cmd[0] == "/addnpc")
{//uid type flags avatar
//StreamWriter SW = new StreamWriter(@"C:\OldCODB\NPCs.txt", true);
//SW.WriteLine(Cmd[1] + ' ' + Cmd[2] + ' ' + Cmd[3] + ' ' + GC.MyChar.Direction + ' ' + Cmd[4] + ' ' + GC.MyChar.Loc.Map + ' ' + GC.MyChar.Loc.X + ' ' + GC.MyChar.Loc.Y);
//SW.Flush();
//SW.Close();
Game.NPC N = new NewestCOServer.Game.NPC(Cmd[1] + ' ' + Cmd[2] + ' ' + Cmd[3] + ' ' + GC.MyChar.Direction + ' ' + Cmd[4] + ' ' + GC.MyChar.Loc.Map + ' ' + GC.MyChar.Loc.X + ' ' + GC.MyChar.Loc.Y);
//Game.World.H_NPCs.Add(N.EntityID, N);
Game.World.Spawn(N);
}
if (Cmd[0] == "/quiz")
if (!Features.QuizShow.QuizON)
Features.QuizShow.Start();
if (Cmd[0] == "/mb")
GC.MyChar.AddItem(721080);
if (Cmd[0] == "/status")
GC.AddSend(Packets.Status(GC.MyChar.EntityID, (NewestCOServer.Game.Status)byte.Parse(Cmd[1]), ulong.Parse(Cmd[2])));
if (Cmd[0] == "/xp")
{
GC.MyChar.StatEff.Add(NewestCOServer.Game.StatusEffectEn.XPStart);
GC.MyChar.Buffs.Add(new Game.Buff() { StEff = NewestCOServer.Game.StatusEffectEn.XPStart, Lasts = 20, Started = DateTime.Now, Eff = NewestCOServer.Features.SkillsClass.ExtraEffect.None });
}
if (Cmd[0] == "/mana")
GC.MyChar.CurMP = (ushort)GC.MyChar.MaxMP;
if (Cmd[0] == "/newguild")
{
if (GC.MyChar.MyGuild == null)
{
try
{
ushort NewGuildID = (ushort)Program.Rnd.Next(ushort.MaxValue);
while (Features.Guilds.AllTheGuilds.Contains(NewGuildID))
NewGuildID = (ushort)Program.Rnd.Next(ushort.MaxValue);
Features.Guilds.CreateNewGuild(Cmd[1], NewGuildID, GC.MyChar);
Game.World.Spawn(GC.MyChar, false);
GC.AddSend(Packets.GuildInfo(GC.MyChar.MyGuild, GC.MyChar));
GC.AddSend(Packets.String(GC.MyChar.MyGuild.GuildID, (byte)Game.StringType.GuildName, GC.MyChar.MyGuild.GuildName));
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
}
if (Cmd[0] == "/tryatk")
GC.AddSend(Packets.AttackPacket(GC.MyChar.EntityID,GC.MyChar.EntityID,GC.MyChar.Loc.X,GC.MyChar.Loc.Y,300,byte.Parse(Cmd[1])));
if (Cmd[0] == "/skill")
GC.MyChar.RWSkill(new Game.Skill() { ID = ushort.Parse(Cmd[1]), Lvl = byte.Parse(Cmd[2]), Exp = 0 });
if (Cmd[0] == "/prof")
GC.MyChar.RWProf(new Game.Prof() { ID = ushort.Parse(Cmd[1]), Lvl = byte.Parse(Cmd[2]), Exp = 0 });
if (Cmd[0] == "/blue")
GC.MyChar.BlueName = !GC.MyChar.BlueName;
if (Cmd[0] == "/level")
{
GC.MyChar.Experience = 0;
GC.MyChar.Level = byte.Parse(Cmd[1]);
}
if (Cmd[0] == "/kick")
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null)
C.MyClient.Disconnect();
}
if (Cmd[0] == "/mob")
GC.AddSend(Packets.SpawnEntity(ushort.Parse(Cmd[1]), "FuckFace" + Cmd[1], GC.MyChar.Loc));
if (Cmd[0] == "/vp")
GC.LocalMessage(2000, "You have " + GC.MyChar.VP + " virtue points.");
if (Cmd[0] == "/map")
GC.LocalMessage(2000, "The ID of the map you are on is " + GC.MyChar.Loc.Map);
if (Cmd[0] == "/job")
GC.MyChar.Job = byte.Parse(Cmd[1]);
if (Cmd[0] == "/silvers")
GC.MyChar.Silvers = uint.Parse(Cmd[1]);
if (Cmd[0] == "/cps")
GC.MyChar.CPs = uint.Parse(Cmd[1]);
if (Cmd[0] == "/tele")
GC.MyChar.Teleport(ushort.Parse(Cmd[1]), ushort.Parse(Cmd[2]), ushort.Parse(Cmd[3]));
if (Cmd[0] == "/item")
{
uint ID = 0;
foreach (DatabaseItem DI in Database.DatabaseItems.Values)
if (DI.Name == Cmd[1])
{
ID = DI.ID;
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
if (e.Quality == Quality)
break;
}
if (ID != 0 && GC.MyChar.Inventory.Count < 40)
{
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
bool change = true;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
else change = false;
if (change)
e.QualityChange(Quality);
ID = e.ToID();
if (!Database.DatabaseItems.ContainsKey(ID))
{
return;
}
Game.Item I = new NewestCOServer.Game.Item();
if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
//I.FreeItem = true;
I.ID = ID;
I.UID = (uint)Program.Rnd.Next(10000000);
try
{
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
try
{
I.Plus = byte.Parse(Cmd[3]);
}
catch { }
try
{
I.Bless = byte.Parse(Cmd[4]);
}
catch { }
try
{
I.Enchant = byte.Parse(Cmd[5]);
}
catch { }
try
{
I.Soc1 = (Game.Item.Gem)byte.Parse(Cmd[6]);
}
catch { }
try
{
I.Soc2 = (Game.Item.Gem)byte.Parse(Cmd[7]);
}
catch { }
I.Effect = NewestCOServer.Game.Item.RebornEffect.None;
GC.MyChar.AddItem(I);
}
}
}
}
else
Game.World.Chat(GC.MyChar, ChatType, From, To, Message);
}
catch { }
}
}
}
There's my Whole Chat.cs and here's my whole Mob.cs about that expection it complains, but still the server is running, just don't know does that got anything to do with it? well here's my Mob.cs
03/01/2010, 22:39
#2
elite*gold: 0
Join Date: Apr 2007
Posts: 142
Received Thanks: 15
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NewestCOServer.Game
{
public enum AttackType : byte
{
Melee = 2,
Ranged = 28,
Magic = 21,
Kill = 14,
FatalStrike = 45,
Scapegoat = 43
}
public enum MobBehaveour : byte
{
HuntPlayers = 1,
HuntMobs = 2,
HuntMobsAndPlayers = 3,
HuntBlueNames = 4,
HuntMobsAndBlue = 6
}
public class Mob
{
DateTime LastMove;
public byte Direction = 0;
public byte Action = 0;
public uint EntityID;
public Location Loc;
public Location StartLoc;
public bool Alive = true;
public bool Dissappeared = false;
public DateTime Died;
public uint RandomTime = 30;
public static Random Rnd = new Random();
public static DateTime LastTarget = DateTime.Now;
Character PlayerTarget;
Mob MobTarget;
public int MobID;
public ushort Mesh;
public byte Level;
public uint MaxHP;
public uint CurrentHP;
public ushort Defense;
public ushort MDef;
public ushort MAttack;
public ushort MinAttack;
public ushort MaxAttack;
public string Name;
public MobBehaveour Type;
public byte DmgReduceTimes;
public AttackType AtkType;
public byte Dodge;
public bool Gives;
public byte AttackDist;
public ushort MagicSkill = 0;
public byte MagicLvl = 0;
public int MinSilvers;
public int MaxSilvers;
uint SpawnSpeed = 0;
ushort MoveSpeed = 0;
bool LevDifDmg = true;
public PoisonType PoisonedInfo = null;
public Mob(string Line)
{
LastMove = DateTime.Now;
string[] Info = Line.Split(' ');
MobID = int.Parse(Info[0]);
Name = Info[1];
Type = (MobBehaveour)byte.Parse(Info[2]);
Mesh = ushort.Parse(Info[3]);
Level = byte.Parse(Info[4]);
MaxHP = uint.Parse(Info[5]);
Defense = ushort.Parse(Info[6]);
MDef = ushort.Parse(Info[7]);
MAttack = ushort.Parse(Info[8]);
MinAttack = ushort.Parse(Info[9]);
MaxAttack = ushort.Parse(Info[10]);
DmgReduceTimes = byte.Parse(Info[11]);
Dodge = byte.Parse(Info[12]);
AtkType = (AttackType)byte.Parse(Info[13]);
if (AtkType == AttackType.Magic)
{
MagicSkill = ushort.Parse(Info[14]);
MagicLvl = byte.Parse(Info[15]);
Gives = bool.Parse(Info[16]);
AttackDist = byte.Parse(Info[17]);
MinSilvers = int.Parse(Info[18]);
MaxSilvers = int.Parse(Info[19]);
MoveSpeed = ushort.Parse(Info[20]);
SpawnSpeed = uint.Parse(Info[21]);
LevDifDmg = bool.Parse(Info[22]);
}
else
{
Gives = bool.Parse(Info[14]);
AttackDist = byte.Parse(Info[15]);
MinSilvers = int.Parse(Info[16]);
MaxSilvers = int.Parse(Info[17]);
MoveSpeed = ushort.Parse(Info[18]);
SpawnSpeed = uint.Parse(Info[19]);
LevDifDmg = bool.Parse(Info[20]);
}
CurrentHP = MaxHP;
}
public Mob(Mob M)
{
LastMove = DateTime.Now;
MobID = M.MobID;
Mesh = M.Mesh;
Level = M.Level;
MaxHP = M.MaxHP;
CurrentHP = M.CurrentHP;
Defense = M.Defense;
MDef = M.MDef;
MAttack = M.MAttack;
MinAttack = M.MinAttack;
MaxAttack = M.MaxAttack;
Name = M.Name;
Type = M.Type;
DmgReduceTimes = M.DmgReduceTimes;
Dodge = M.Dodge;
AtkType = M.AtkType;
Gives = M.Gives;
AttackDist = M.AttackDist;
MagicSkill = M.MagicSkill;
MagicLvl = M.MagicLvl;
MinSilvers = M.MinSilvers;
MaxSilvers = M.MaxSilvers;
MoveSpeed = M.MoveSpeed;
SpawnSpeed = M.SpawnSpeed;
LevDifDmg = M.LevDifDmg;
}
uint PrepareAttack()
{
if (AtkType == AttackType.Melee || AtkType == AttackType.Ranged)
return (uint)Rnd.Next(MinAttack, MaxAttack);
else
return MAttack;
}
public bool NeedsPKMode
{
get
{
if (Type == MobBehaveour.HuntBlueNames || Type == MobBehaveour.HuntMobsAndBlue)
return true;
return false;
}
}
public uint TakeAttack(Character Attacker,ref uint Damage, AttackType AT, bool IsSkill)
{
if (AT != AttackType.Magic && Attacker.BuffOf(Features.SkillsClass.ExtraEffect.Superman).Eff == Features.SkillsClass.ExtraEffect.Superman)
Damage *= 10;
if (!IsSkill && Attacker.BuffOf(Features.SkillsClass.ExtraEffect.FatalStrike).Eff == Features.SkillsClass.ExtraEffect.FatalStrike)
{
AT = AttackType.FatalStrike;
Damage *= 5;
}
double e = 1;
if (Level + 4 < Attacker.Level)
e = 0.1;
if (Level + 4 >= Attacker.Level)
e = 1;
if (Level >= Attacker.Level)
e = 1.1;
if (Level - 4 > Attacker.Level)
e = 1.3;
if (Type == MobBehaveour.HuntBlueNames || Type == MobBehaveour.HuntMobsAndBlue)
{
Attacker.BlueName = true;
if (Attacker.BlueNameLasts < 60)
Attacker.BlueNameLasts = 15;
}
if (AT != AttackType.Magic && !IsSkill)
{
short _Agi = (short)(Attacker.Agi + Attacker.EqStats.ExtraDex);
Buff Accuracy = Attacker.BuffOf(Features.SkillsClass.ExtraEffect.Accuracy);
if (Accuracy.Eff == Features.SkillsClass.ExtraEffect.Accuracy)
_Agi = (short)(_Agi * Accuracy.Value);
Buff SM = Attacker.BuffOf(Features.SkillsClass.ExtraEffect.Superman);
if (SM.StEff == StatusEffectEn.SuperMan)
_Agi *= 2;
double MissValue = Rnd.Next(15 + _Agi, _Agi + Dodge + 15);
if (MissValue <= Dodge && AT != AttackType.FatalStrike)
Damage = 0;
else
{
if (LevDifDmg) Damage = (uint)(Damage * MyMath.LevelDifference(Attacker.Level, Level));
}
}
if (!IsSkill && Damage != 0)
{
if (AT == AttackType.Melee || AT == AttackType.FatalStrike)
{
if (Defense >= Damage)
Damage = 1;
else
Damage -= Defense;
Damage += Attacker.EqStats.MeleeDamageIncrease;
}
else if (AT == AttackType.Ranged)
{
Damage = (uint)((double)Damage * ((double)(200 - Dodge) / 100));
Damage += Attacker.EqStats.MeleeDamageIncrease;
}
else
{
if (MDef >= Damage)
Damage = 1;
else
Damage -= MDef;
Damage += Attacker.EqStats.MagicDamageIncrease;
}
Damage = (uint)(Damage / DmgReduceTimes);
}
uint Exp = 0;
if (Damage < CurrentHP)
{
CurrentHP -= Damage;
if (!IsSkill)
{
if (AT == AttackType.FatalStrike)
{
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, (ushort)(Loc.X + 1), (ushort)(Loc.Y + 1), Damage, (byte)AT).Get);
Attacker.Shift((ushort)(Loc.X), (ushort)(Loc.Y));
}
else if (AT == AttackType.Scapegoat)
{
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, 43).Get);
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, 2).Get);
}
else
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
}
if (Gives)
{
Exp = (uint)(Damage * e);
if (!IsSkill)
{
if (AT == AttackType.Ranged || AT == AttackType.Melee || AT == AttackType.FatalStrike)
{
if (Attacker.Equips.RightHand.ID != 0)
Attacker.AddProfExp((ushort)Game.ItemIDManipulation.Part(Attacker.Equips.RightHand.ID, 0, 3), Damage);
if (Attacker.Equips.LeftHand.ID != 0)
Attacker.AddProfExp((ushort)Game.ItemIDManipulation.Part(Attacker.Equips.LeftHand.ID, 0, 3), Damage / 3 * 2);
}
}
}
}
else
{
Attacker.XPKO++;
if (Attacker.Superman || Attacker.Cyclone)
Attacker.TotalKO++;
PlayerTarget = null;
Alive = false;
uint Benefit = CurrentHP;
CurrentHP = 0;
PoisonedInfo = null;
Died = DateTime.Now;
if (!IsSkill)
{
if (AT == AttackType.FatalStrike)
{
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, (ushort)(Loc.X + 1), (ushort)(Loc.Y + 1), Damage, (byte)AT).Get);
Attacker.Shift((ushort)(Loc.X), (ushort)(Loc.Y));
}
else if (AT == AttackType.Scapegoat)
{
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, 43).Get);
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, 2).Get);
}
else
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
}
if (Attacker.Superman || Attacker.Cyclone)
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, (uint)(65536 * Attacker.TotalKO), (byte)AttackType.Kill).Get);
else
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, (uint)(1), (byte)AttackType.Kill).Get);
World.Action(this, Packets.Status(EntityID, Status.Effect, 2080).Get);
Attacker.AtkMem.Attacking = false;
Attacker.AtkMem.Target = 0;
if (Gives)
{
Exp = (uint)(Benefit * e);
if (Attacker.MyTeam != null)
{
foreach (Character C in Attacker.MyTeam.Members)
{
if (C != Attacker && C.Alive && MyMath.InBox(C.Loc.X, C.Loc.Y, Attacker.Loc.X, Attacker.Loc.Y, 18))
{
if (C.Level + 20 > Level || C.Level >= 70)
{
C.IncreaseExp(MaxHP / 10, true);
}
else
{
uint Amount = (uint)(356 + (C.Level * 27));
byte Lev = C.Level;
C.IncreaseExp(Amount, true);
for (; Lev < C.Level; Lev++)
{
uint VPAmount = (uint)Math.Max(1, Lev * 12 - 17);
Attacker.MyTeam.Leader.VP += VPAmount;
Attacker.MyTeam.Message(Packets.ChatMessage(45216, "SYSTEM", "ALL", Attacker.MyTeam.Leader.Name + " gained " + VPAmount + " virtue points.", 2003, 0));
}
}
}
}
}
Attacker.IncreaseExp(MaxHP / 10, false);
if (!IsSkill)
{
if (AT == AttackType.Ranged || AT == AttackType.Melee || AT == AttackType.FatalStrike)
{
if (Attacker.Equips.RightHand.ID != 0)
Attacker.AddProfExp((ushort)Game.ItemIDManipulation.Part(Attacker.Equips.RightHand.ID, 0, 3), Benefit);
if (Attacker.Equips.LeftHand.ID != 0)
Attacker.AddProfExp((ushort)Game.ItemIDManipulation.Part(Attacker.Equips.LeftHand.ID, 0, 3), Benefit / 3 * 2);
}
}
DropAnItem(Attacker.EntityID, Attacker.Level);
}
}
if (!IsSkill)
Attacker.IncreaseExp(Exp, false);
return Exp;
}
public void TakeAttack(Mob Attacker, uint Damage, AttackType AT)
{
try
{
if (LevDifDmg) Damage = (uint)(Damage * MyMath.LevelDifference(Attacker.Level, Level));
Damage = (uint)(Damage / DmgReduceTimes);
if (AT == AttackType.Melee)
{
if (Defense >= Damage)
Damage = 1;
else
Damage -= Defense;
}
else if (AT == AttackType.Ranged)
Damage = (uint)((double)Damage * ((double)Dodge / 100));
else if (AT == AttackType.Magic)
{
if (MDef >= Damage)
Damage = 1;
else
Damage -= MDef;
}
if (Damage < CurrentHP)
{
CurrentHP -= Damage;
if (AT == AttackType.Magic)
World.Action(this, Packets.SkillUse(Attacker.EntityID, EntityID, Damage, Attacker.MagicSkill, Attacker.MagicLvl, Loc.X, Loc.Y).Get);
else
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
}
else
{
PoisonedInfo = null;
PlayerTarget = null;
Alive = false;
uint Benefit = CurrentHP;
CurrentHP = 0;
Died = DateTime.Now;
if (AT == AttackType.Magic)
World.Action(this, Packets.SkillUse(Attacker.EntityID, EntityID, Damage, Attacker.MagicSkill, Attacker.MagicLvl, Loc.X, Loc.Y).Get);
else
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AttackType.Kill).Get);
World.Action(this, Packets.Status(EntityID, Status.Effect, 2080).Get);
if (Gives)
DropAnItem(0, Attacker.Level);
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
public void TakeAttack(Companion Attacker, uint Damage, AttackType AT)
{
try
{
if (LevDifDmg) Damage = (uint)(Damage * MyMath.LevelDifference(Attacker.Level, Level));
Damage = (uint)(Damage / DmgReduceTimes);
if (AT == AttackType.Melee)
{
if (Defense >= Damage)
Damage = 1;
else
Damage -= Defense;
}
else if (AT == AttackType.Ranged)
Damage = (uint)((double)Damage * ((double)Dodge / 100));
else if (AT == AttackType.Magic)
{
if (MDef >= Damage)
Damage = 1;
else
Damage -= MDef;
}
if (Damage < CurrentHP)
{
CurrentHP -= Damage;
if (AT == AttackType.Magic)
World.Action(this, Packets.SkillUse(Attacker.EntityID, EntityID, Damage, (ushort)Attacker.SkillUses, 0, Loc.X, Loc.Y).Get);
else
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
if (Gives)
Attacker.Owner.IncreaseExp(Damage, false);
}
else
{
PoisonedInfo = null;
PlayerTarget = null;
Alive = false;
uint Benefit = CurrentHP;
CurrentHP = 0;
Died = DateTime.Now;
if (AT == AttackType.Magic)
World.Action(this, Packets.SkillUse(Attacker.EntityID, EntityID, Damage, (ushort)Attacker.SkillUses, 0, Loc.X, Loc.Y).Get);
else
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AttackType.Kill).Get);
World.Action(this, Packets.Status(EntityID, Status.Effect, 2080).Get);
if (Gives)
{
DropAnItem(Attacker.Owner.EntityID, Attacker.Level);
Attacker.Owner.IncreaseExp(Benefit, false);
}
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
void DropAnItem(uint Owner, byte OwnerLevel)
{
try
{
ArrayList Arr = (ArrayList)DropRates.Specifics[MobID];
if (Arr != null)
{
foreach (DropRates.RateItemInfo R in Arr)
{
if (MyMath.ChanceSuccess(R.DropChance) && Level + 20 > OwnerLevel)
{
DroppedItem DI = new DroppedItem();
DI.DropTime = DateTime.Now;
DI.UID = (uint)Rnd.Next(10000000);
DI.Loc = new Location();
DI.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
DI.Loc.Map = Loc.Map;
DI.Info = new Item();
DI.Info.ID = R.ID;
DI.Info.UID = (uint)Rnd.Next(10000000);
DI.Info.Plus = R.Plus;
DI.Info.Bless = R.Bless;
if (R.Sockets >= 1)
DI.Info.Soc1 = Item.Gem.EmptySocket;
if (R.Sockets >= 2)
DI.Info.Soc2 = Item.Gem.EmptySocket;
try
{
DI.Info.MaxDur = DI.Info.DBInfo.Durability;
DI.Info.CurDur = DI.Info.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
DI.Owner = Owner;
if (!DI.FindPlace((Hashtable)Game.World.H_Items[Loc.Map]))
{
DI.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
}
if (!DI.FindPlace((Hashtable)Game.World.H_Items[Loc.Map])) continue;
DI.Drop();
}
}
}
DroppedItem DI2 = new DroppedItem();
DI2.DropTime = DateTime.Now;
DI2.UID = (uint)Rnd.Next(10000000);
DI2.Loc = new Location();
DI2.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI2.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
DI2.Loc.Map = Loc.Map;
DI2.Info = new Item();
DI2.Info.UID = (uint)Rnd.Next(10000000);
DI2.Owner = Owner;
Game.Character Char = null;
if (Game.World.H_Chars.ContainsKey(Owner))
Char = (Character)Game.World.H_Chars[Owner];
if (MyMath.ChanceSuccess(100))
{
string acc = "";
int cpDroprate = 600;//rate of cp for server
int cpLow = 100;//min cp drop
int cpHigh = 580;// max cp drop
int cpMultiplyer = 7;// cp drop multiplier
double cpMobDropRate = (Convert.ToDouble(MobTarget.Level) / Convert.ToDouble(Char.Level)) * cpDroprate;
if (MyMath.ChanceSuccess(cpMobDropRate))
{
Random rand = new Random();
int cpBaseReward = rand.Next(cpLow, cpHigh);
int cpToAdd = cpBaseReward * cpMultiplyer;
Char.CPs += Convert.ToUInt32(cpToAdd);
Char.MyClient.LocalMessage(2005, "[CPs] You have gained: " + cpToAdd + " CPs for killing a(n) " + MobTarget.Name);
Database.SaveCharacter(Char, acc);
}
}
if (MyMath.ChanceSuccess(30))
{
DI2.Silvers = (uint)(Rnd.Next(MinSilvers, MaxSilvers) * DropRates.Silver);
if(Char != null)
if (Char.VipLevel >= 3)
{
Char.Silvers += DI2.Silvers;
return;
}
DI2.UID = (uint)Rnd.Next(10000000);
DI2.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI2.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
if (DI2.Silvers < 10)
DI2.Info.ID = 1090000;
else if (DI2.Silvers < 100)
DI2.Info.ID = 1090010;
else if (DI2.Silvers < 1000)
DI2.Info.ID = 1090020;
else if (DI2.Silvers < 3000)
DI2.Info.ID = 1091000;
else if (DI2.Silvers < 10000)
DI2.Info.ID = 1091010;
else
DI2.Info.ID = 1091020;
if (!DI2.FindPlace((Hashtable)Game.World.H_Items[Loc.Map])) return;
DI2.Drop();
}
else
{
if (MyMath.ChanceSuccess(DropRates.DragonBall))
{
if (Char != null)
if (Char.VipLevel >= 3)
{
if (Char.Inventory.Count <= 39)
{
Char.AddItem(1088000);
return;
}
}
DI2.Info.ID = 1088000;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.Meteor))
{
DI2.Info.ID = 1088001;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.CPMiniBag))
{
if (Char != null)
if (Char.VipLevel >= 3)
{
if (Char.Inventory.Count <= 39)
{
Char.AddItem(729910);
return;
}
}
DI2.Info.ID = 729910;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.CPBag))
{
if (Char != null)
if (Char.VipLevel >= 3)
{
if (Char.Inventory.Count <= 39)
{
Char.AddItem(729911);
return;
}
}
DI2.Info.ID = 729911;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.CPBackpack))
{
if (Char != null)
if (Char.VipLevel >= 3)
{
if (Char.Inventory.Count <= 39)
{
Char.AddItem(729912);
return;
}
}
DI2.Info.ID = 729912;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.PointCard))
{
if (Char != null)
if (Char.VipLevel >= 3)
{
if (Char.Inventory.Count <= 39)
{
Char.AddItem(780000);
return;
}
}
DI2.Info.ID = 780000;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.PlusOneStone))
{
DI2.Info.ID = 730001;
DI2.Info.Plus = 1;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.PlusTwoStone))
{
DI2.Info.ID = 730002;
DI2.Info.Plus = 2;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.CleanWater))
{
DI2.Info.ID = 721258;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.Gem))
{
DI2.Info.ID = (uint)(700001 + Rnd.Next(8) * 10);
if (MyMath.ChanceSuccess(15)) DI2.Info.ID = 700121;
if (MyMath.ChanceSuccess(15)) DI2.Info.ID = 700101;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.Item))
{
Item.ItemQuality Q = Item.ItemQuality.Simple;
if (MyMath.ChanceSuccess(DropRates.Refined))
Q = Item.ItemQuality.Refined;
if (MyMath.ChanceSuccess(DropRates.Unique))
Q = Item.ItemQuality.Unique;
if (MyMath.ChanceSuccess(DropRates.Elite))
Q = Item.ItemQuality.Elite;
if (MyMath.ChanceSuccess(DropRates.Super))
Q = Item.ItemQuality.Super;
uint ItemID = 0;
ArrayList From = new ArrayList();
foreach (DatabaseItem D in Database.DatabaseItems.Values)
{
if (D.LevReq + 5 > Level && D.LevReq - 5 <= Level)
{
if (D.LevReq != 0)
From.Add(D.ID);
}
}
if (From != null)
{
byte Tries = (byte)Rnd.Next(0, From.Count);
ItemID = (uint)From[Tries];
}
if (ItemID != 0)
{
DI2.Info.ID = ItemID;
if (DI2.Info.DBInfo.LevReq != 1)
{
ItemIDManipulation E = new ItemIDManipulation(ItemID);
E.QualityChange(Q);
DI2.Info.ID = E.ToID();
}
DI2.Info.Color = Item.ArmorColor.Orange;
if (ItemIDManipulation.Digit(DI2.Info.ID, 1) == 4 || ItemIDManipulation.Digit(DI2.Info.ID, 1) == 5)
{
if (MyMath.ChanceSuccess(DropRates.OneSoc))
DI2.Info.Soc1 = Item.Gem.EmptySocket;
if (MyMath.ChanceSuccess(DropRates.TwoSoc))
{
DI2.Info.Soc1 = Item.Gem.EmptySocket;
DI2.Info.Soc2 = Item.Gem.EmptySocket;
}
}
if (MyMath.ChanceSuccess(DropRates.PlusOne))
DI2.Info.Plus = 1;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
if(Q == Item.ItemQuality.Super || Q == Item.ItemQuality.Elite)
if (Char != null)
if (Char.VipLevel >= 3)
{
if (Char.Inventory.Count <= 39)
{
Char.AddItem(DI2.Info.ID);
return;
}
}
}
}
if (DI2.Info.ID != 0)
{
if (!DI2.FindPlace((Hashtable)Game.World.H_Items[Loc.Map])) return;
DI2.Drop();
}
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
public void Respawn()
{
try
{
Loc = StartLoc;
Alive = true;
CurrentHP = MaxHP;
Action = 100;
World.Spawn(this, false);
World.Action(this, Packets.String(EntityID, 10, "MBStandard").Get);
Dissappeared = false;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
public void Step()
{
try
{
if (!Alive)
{
if (!Dissappeared && DateTime.Now > Died.AddSeconds(2))
{
World.Action(this, Packets.GeneralData(EntityID, 0, 0, 0, 135).Get);
Dissappeared = true;
RandomTime = (uint)(Rnd.Next(20, 60));
}
if (DateTime.Now > Died.AddSeconds(SpawnSpeed + RandomTime))//changed back to 30 by Ricardo
Respawn();
}
if (Alive && DateTime.Now > LastMove.AddMilliseconds(1000))
{
LastMove = DateTime.Now;
if ((Type == MobBehaveour.HuntPlayers || Type == MobBehaveour.HuntMobsAndBlue) && PlayerTarget == null && MobTarget == null)
{
byte NDist = 11;
byte MaxDist = 10;
foreach (Character C in World.H_Chars.Values)
{
if (C.Loc.Map == Loc.Map)
{
if (C.Alive)
{
if (C.CanBeMeleed || AtkType != AttackType.Melee)
{
byte Dst = (byte)MyMath.PointDistance(Loc.X, Loc.Y, C.Loc.X, C.Loc.Y);
if (Dst <= MaxDist && Dst < NDist)
{
if (Type != MobBehaveour.HuntMobsAndBlue || C.BlueName)
{
NDist = (byte)MyMath.PointDistance(Loc.X, Loc.Y, C.Loc.X, C.Loc.Y);
PlayerTarget = C;
}
}
}
}
}
}
}
if (Type == MobBehaveour.HuntMobs || Type == MobBehaveour.HuntMobsAndBlue && MobTarget == null && PlayerTarget == null)
{
byte NDist = 15;
byte MaxDist = 8;
foreach (Mob M in ((Hashtable)World.H_Mobs[Loc.Map]).Values)
if (M != this && M.Type == MobBehaveour.HuntPlayers && M.Alive && MyMath.PointDistance(Loc.X, Loc.Y, M.Loc.X, M.Loc.Y) <= MaxDist && MyMath.PointDistance(Loc.X, Loc.Y, M.Loc.X, M.Loc.Y) < NDist)
{
NDist = (byte)MyMath.PointDistance(Loc.X, Loc.Y, M.Loc.X, M.Loc.Y);
MobTarget = M;
}
}
#region Player Target
if (PlayerTarget != null && (PlayerTarget.CanBeMeleed || AtkType != AttackType.Melee) && PlayerTarget.Alive && PlayerTarget.MyClient != null && MyMath.PointDistance(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) < Math.Max(15, (int)AttackDist) && (Type != MobBehaveour.HuntMobsAndBlue || PlayerTarget.BlueName))
{
if (MyMath.PointDistance(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) >= AttackDist)
{
byte ToDir = (byte)(7 - (Math.Floor(MyMath.PointDirecton(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) / 45 % 8)) - 1 % 8);
Direction = (byte)((int)ToDir % 8);
Location eLoc = Loc;
eLoc.Walk(Direction);
System.Collections.Hashtable H = (System.Collections.Hashtable)World.H_Mobs[Loc.Map];
bool PlaceFree = true;
if (DMaps.Loaded)
{
if (((DMap)DMaps.H_DMaps[Loc.Map]).GetCell(eLoc.X, eLoc.Y).NoAccess) PlaceFree = false;
}
foreach (Mob M in H.Values)
if (M != this && M.Loc.X == eLoc.X && M.Loc.Y == eLoc.Y && M.Alive)
{
PlaceFree = false;
break;
}
if (PlaceFree)
{
World.Action(this, Packets.Movement(EntityID, Direction).Get);
World.Spawn(this, true);
Loc.Walk(Direction);
}
else
{
for (int i = 0; i < 7; i++)
{
PlaceFree = true;
eLoc = Loc;
Direction = (byte)((Direction + 1) % 8);
eLoc.Walk(Direction);
if (DMaps.Loaded)
if (((DMap)DMaps.H_DMaps[Loc.Map]).GetCell(eLoc.X, eLoc.Y).NoAccess) PlaceFree = false;
foreach (Mob M in H.Values)
if (M != this && M.Loc.X == eLoc.X && M.Loc.Y == eLoc.Y && M.Alive)
{
PlaceFree = false;
break;
}
if (PlaceFree)
{
World.Action(this, Packets.Movement(EntityID, Direction).Get);
World.Spawn(this, true);
Loc.Walk(Direction);
break;
}
}
}
}
else
{
if (MyMath.ChanceSuccess(15) || Type == MobBehaveour.HuntMobsAndBlue)
PlayerTarget.TakeAttack(this, PrepareAttack(), AtkType);
else
PlayerTarget.TakeAttack(this, 0, AtkType);
}
}
else PlayerTarget = null;
#endregion
#region Mob Target
if (MobTarget != null && MobTarget.Alive && MyMath.PointDistance(Loc.X, Loc.Y, MobTarget.Loc.X, MobTarget.Loc.Y) < 13)
{
if (MyMath.PointDistance(Loc.X, Loc.Y, MobTarget.Loc.X, MobTarget.Loc.Y) >= AttackDist)
{
byte ToDir = (byte)(7 - (Math.Floor(MyMath.PointDirecton(Loc.X, Loc.Y, MobTarget.Loc.X, MobTarget.Loc.Y) / 45 % 8)) - 1 % 8);
Direction = (byte)((int)ToDir % 8);
Location eLoc = Loc;
eLoc.Walk(Direction);
System.Collections.Hashtable H = (System.Collections.Hashtable)World.H_Mobs[Loc.Map];
bool PlaceFree = true;
if (((DMap)DMaps.H_DMaps[Loc.Map]).GetCell(eLoc.X, eLoc.Y).NoAccess) PlaceFree = false;
foreach (Mob M in H.Values)
if (M != this && M.Loc.X == eLoc.X && M.Loc.Y == eLoc.Y && M.Alive)
{
PlaceFree = false;
break;
}
if (PlaceFree)
{
World.Action(this, Packets.Movement(EntityID, Direction).Get);
World.Spawn(this, true);
Loc.Walk(Direction);
}
else
{
for (int i = 0; i < 7; i++)
{
PlaceFree = true;
eLoc = Loc;
Direction = (byte)((Direction + 1) % 8);
eLoc.Walk(Direction);
if (((DMap)DMaps.H_DMaps[Loc.Map]).GetCell(eLoc.X, eLoc.Y).NoAccess) PlaceFree = false;
foreach (Mob M in H.Values)
if (M != this && M.Loc.X == eLoc.X && M.Loc.Y == eLoc.Y && M.Alive)
{
PlaceFree = false;
break;
}
if (PlaceFree)
{
World.Action(this, Packets.Movement(EntityID, Direction).Get);
World.Spawn(this, true);
Loc.Walk(Direction);
break;
}
}
}
}
else
{
MobTarget.TakeAttack(this, PrepareAttack(), AtkType);
}
}
else MobTarget = null;
#endregion
}
}
catch { }
}
}
}
Theres My Mob.cs (sorry for double posting, but didnt have enough space so had to do 2nd post)
Similar Threads
RF Up5 GM Commands
10/30/2010 - RFO Hacks, Bots, Cheats, Exploits & Guides - 49 Replies
For who know how to do GM commands w/o be a GM (not like me :( ) or for owner of server
//E2P1G5 Updated RF GM commands
ALT+B (Opens observer menu which enables fly/noclip mode.)
/add <USERNAME> (Add the user to your player list, only usable in observer mode, must have player targeted when you do it.)
/remove <USERNAME> (Remove player from observer list.)
/add (Use this command to add a...
GM Commands
07/03/2010 - General Gaming Discussion - 6 Replies
Was wondering if anyone would be kind enough to leak the GM commands??? Or provide any insight on how to find them. If so pls post or PM. TY
[Key Commands] Default Key Commands for the beginners
10/01/2008 - General Gaming Releases - 0 Replies
Default keybindings:
Abilities Window V
Backpack Window: B
Career Window: K
Character Window: C
Battlegroup Window: Left Alt + R
Developer Window: ;
Guild Window: G
Help Window: H
new GM Commands,most of EO
05/06/2008 - EO PServer Hosting - 6 Replies
There is some new gamemaster commands.
set to gm, type follow your player name, like youname.
You can link to 天晴魔域技术论坛 - - powered by bbsmax for more help of Chinese
The text "未知" is unknow in english.
:eek:
/amount_limit 未知
/attach ?查询奖品
/auto_pathfind 未知
/awardattrib1info 未知
/commands
12/18/2007 - Conquer Online 2 - 6 Replies
Does anyone know how to get the /look commands to work for the new patch, any help would be much apreciated.
Chem.
All times are GMT +2. The time now is 15:28 .