GameState.cs
public uint UID {get; set;} / /
Database
PkExplTable.cs calls and degrade the code
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Client;
using Conquer_Online_Server.Game;
namespace Conquer_Online_Server.Database
{
public class PkExpelTable
{
public static void AddPKE (GameState Killer, GameState Killed, string MapName)
{
try
{
PkExpeliate expeliate = new PkExpeliate
{
Times = 1
};
MySqlCommand command = new MySqlCommand (MySqlCommandType.INSERT);
command.Insert ("pk_explorer"). Insert ("killed_uid", (long) Killed.Account.EntityID). Insert ("uid", (long) Killer.Account.EntityID). Insert ("killed_name", Killed.Entity . Name). Insert ("killed_map", MapName). Insert ("battle_power", (long) Killed.Entity.BattlePower). Insert ("level", (long) Killed.Entity.Level). Insert ("times" , (long) expeliate.Times). Insert ("lost_exp", Killed.Entity.Experience). Execute ();
}
catch (Exception exception)
{
Program.SaveException (exception);
}
}
public static void UpdatePKE (GameState Killer, GameState Killed, string MapName, uint Pktimes)
{
try
{
PkExpeliate expeliate = new PkExpeliate
{
Times = Pktimes
};
MySqlCommand command = new MySqlCommand (MySqlCommandType.INSERT);
command.Insert ("pk_explorer"). Insert ("killed_uid", (long) Killed.Account.EntityID). Insert ("uid", (long) Killer.Account.EntityID). Insert ("killed_name", Killed.Entity . Name). Insert ("killed_map", MapName). Insert ("battle_power", (long) Killed.Entity.BattlePower). Insert ("level", (long) Killed.Entity.Level). Insert ("times" , (long) expeliate.Times). Insert ("lost_exp", Killed.Entity.Experience). Execute ();
}
catch (Exception exception)
{
Program.SaveException (exception);
}
}
public static void Load (GameState client)
{
try
{
MySqlCommand command = new MySqlCommand (MySqlCommandType.SELECT);
command.Select ("pk_explorer"). Where ("uid", (long) client.Account.EntityID);
MySqlReader reader = new MySqlReader (command);
while (reader.Read ())
{
PkExpeliate expeliate = new PkExpeliate ();
expeliate.UID = reader.ReadUInt32 ("killed_uid");
expeliate.Name = reader.ReadString ("killed_name");
expeliate.KilledAt = reader.ReadString ("killed_map");
expeliate.LostExp = reader.ReadUInt32 ("lost_exp");
expeliate.Times = reader.ReadUInt32 ("times");
expeliate.Potency = reader.ReadUInt32 ("battle_power");
expeliate.Level = reader.ReadByte ("level");
client.Entity.PkExplorerValues.Add (expeliate.UID, expeliate);
}
reader.Close ();
}
catch (Exception exception)
{
Program.SaveException (exception);
}
}
public static void PkExploitAdd (Client.GameState client, uint UIDEnemy, Game.PkExpeliate pk)
{
MySqlCommand cmds = new MySqlCommand (MySqlCommandType.SELECT);
cmds.Select ("pk_explorer"). Where ("uid", client.Account.EntityID);
MySqlReader rdr = new MySqlReader (cmds);
if (rdr.Read ())
{
MySqlCommand cmd = new MySqlCommand (MySqlCommandType.UPDATE);
cmd.Update ("pk_explorer"). Where ("uid", client.Account.EntityID)
. Set ("uid", pk.UID). Set ("killed_uid", UIDEnemy)
. Set ("killed_name", pk.Name). Set ("killed_map", pk.KilledAt)
. Set ("lost_exp", pk.LostExp). Set ("times", pk.Times)
. Set ("battle_power", pk.Potency). Set ("level", pk.Level);
cmd.Execute ();
if (! client.Entity.PkExplorerValues.ContainsKey (pk.UID))
client.Entity.PkExplorerValues.Add (pk.UID, pk);
}
else
{
MySqlCommand cmd = new MySqlCommand (MySqlCommandType.INSERT);
cmd.Insert ("pk_explorer"). Where ("uid", client.Account.EntityID)
. Insert ("uid", pk.UID). Insert ("killed_uid", UIDEnemy)
. Insert ("killed_name", pk.Name). Insert ("killed_map", pk.KilledAt)
. Insert ("lost_exp", pk.LostExp). Insert ("times", pk.Times)
. Insert ("battle_power", pk.Potency). Insert ("level", pk.Level);
cmd.Execute ();
if (! client.Entity.PkExplorerValues.ContainsKey (pk.UID))
client.Entity.PkExplorerValues.Add (pk.UID, pk);
}
}
}
}
The intervention on the EntityTable.cs spin on
Code:
client.Entity.FullyLoaded = true;
And derogatory instant code
Code:
PkExpelTable.Load (client);
Entity.cs
Code:
PacketHandler.AddEnemy (this.Owner, killer.Owner);
}
}
Code:
/ /
if (! this.PkExplorerValues.ContainsKey (this.Owner.UID))
{
Network.PacketHandler.AddPKExplorer (killer.Owner, this.Owner);
}
else
{
Network.PacketHandler.UpdatePKExplorer (killer.Owner, this.Owner);
}
Code:
public SafeDictionary <uint, PkExpeliate> PkExplorerValues = new SafeDictionary <uint, PkExpeliate> ();
public Enums.Maps Mapa
{
get;
set;
}
Packethandler.cs
void AddFlowers
Code:
# Region PkExplicate
public static unsafe void AddPKExplorer (GameState gameState, GameState gameState_2)
{
if (gameState.Entity.PkExplorerValues.ContainsKey (gameState.Entity.UID) == false)
gameState.Entity.PkExplorerValues.Add (gameState.Entity.UID, new Game.PkExpeliate () {UID = gameState_2.Entity.UID, Level = gameState_2.Entity.Level, Times = 1, Potency = (uint) gameState_2.Entity. BattlePower, KilledAt = gameState.Entity.Name, Name = gameState_2.Entity.Name, LostExp = 2000});
if (gameState.Entity.PkExplorerValues.ContainsKey (gameState.Entity.UID) == true)
{
Game.PkExpeliate Pkp;
if (gameState.Entity.PkExplorerValues.TryGetValue (gameState.Entity.UID, out Pkp))
{
Database.PkExpelTable.AddPKE (gameState, gameState_2, gameState.Entity.Mapa.ToString ());
}
}
}
public static unsafe void UpdatePKExplorer (GameState gameState, GameState gameState_2)
{
if (gameState.Entity.PkExplorerValues.ContainsKey (gameState.Entity.UID) == true)
{
Game.PkExpeliate Pkp;
if (gameState.Entity.PkExplorerValues.TryGetValue (gameState.Entity.UID, out Pkp))
{
Pkp.Times + +;
Database.PkExpelTable.UpdatePKE (gameState, gameState_2, gameState.Entity.Mapa.ToString (), Pkp.Times);
}
}
}
# Endregion
void handlepacket
Code:
# Region PK explorer (2220)
case 2220:
{
PkExplorer pk = new PkExplorer (packet, client);
pk.SubType = 1;
client.Send (pk.Build ());
break;
}
# Endregion







