本文整理汇总了C#中Entities.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.Send方法的具体用法?C# Entities.Send怎么用?C# Entities.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static void Create(Entities.GameClient client, Packets.TeamActionPacket packet)
{
if (packet.EntityUID != client.EntityUID)
return;
if (client.Team != null)
return;
client.Team = new Team();
client.Team.Leader = client.EntityUID;
if (client.Team.Members.TryAdd(client.EntityUID, client))
{
using (var create = new Packets.TeamActionPacket())
{
create.EntityUID = client.EntityUID;
create.Action = Enums.TeamAction.Leader;
client.Send(create);
create.Action = Enums.TeamAction.Create;
client.Send(create);
}
client.AddStatusEffect1(Enums.Effect1.TeamLeader, 0);
}
else
{
client.Team = null;
}
}
示例2: Handle
/// <summary>
/// Handling the Court action of the interaction packet.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="interact">The interaction packet.</param>
public static void Handle(Entities.GameClient client, InteractionPacket interact)
{
//uint marryUID = interact.TargetUID;
//Entities.GameClient marrytarget;
Maps.IMapObject obj;
if (client.Map.MapObjects.TryGetValue(interact.TargetUID, out obj))
{
Entities.GameClient targ = obj as Entities.GameClient;
if (client.SpouseDatabaseUID > 0)
{
using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_SELF_SPOUSE))
client.Send(fmsg);
return;
}
if (targ.SpouseDatabaseUID > 0)
{
using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_TARGET_SPOUSE))
client.Send(fmsg);
return;
}
targ.Send(interact);
}
}
示例3: Handle
/// <summary>
/// Handles the AddItem subtype of the TradePacket.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="trade">The trade packet.</param>
public static void Handle(Entities.GameClient client, TradePacket trade)
{
if (!client.Trade.Trading)
return;
if (!client.Trade.WindowOpen)
return;
uint itemuid = trade.TargetUID;
if (client.Inventory.ContainsByUID(itemuid))
{
Data.ItemInfo item = client.Inventory[itemuid];
if (!item.IsValidOffItem())
{
using (var fmsg = Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.NO_PERMISSION_ITEM))
{
client.Send(fmsg);
}
return;
}
if ((client.Trade.Partner.Inventory.Count + client.Trade.Items.Count) >= 40)
{
using (var fmsg = Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.TARGET_FULL_INVENTORY))
{
client.Send(fmsg);
}
return;
}
client.Trade.Items.Add(item);
item.SendPacket(client.Trade.Partner, 2);
}
}
示例4: Handle
/// <summary>
/// Handling the Sell action from the ItemPacket.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="item">The item packet.</param>
public static void Handle(Entities.GameClient client, ItemPacket packet)
{
if (client.Booth != null)
return;
if (!client.Alive)
return;
Data.Shop shop;
if (Core.Kernel.Shops.TryGetValue(packet.UID, out shop))
{
if (Core.Screen.GetDistance(shop.AssociatedNPC.X, shop.AssociatedNPC.Y, client.X, client.Y) >= Core.NumericConst.MaxNPCDistance)
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.TOO_FAR_NPC))
client.Send(fmsg);
return;
}
Data.ItemInfo sellitem = client.Inventory.GetItemByUID(packet.Data1);
if (!sellitem.IsValidOffItem())
{
using (var fmsg = Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.NO_PERMISSION_ITEM))
{
client.Send(fmsg);
}
return;
}
uint giveback = (uint)(sellitem.Price / 3);
if (client.Inventory.RemoveItemByUID(packet.Data1) != null)
{
client.Money += giveback;
}
}
}
示例5: Handle
/// <summary>
/// Handling the EnterMap action from GeneralDataPacket.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="General">The GeneralDataPacket.</param>
public static void Handle(Entities.GameClient client, GeneralDataPacket General)
{
if (!Core.Kernel.Clients.Contains(client.EntityUID))
{
client.NetworkClient.Disconnect("Not added in clients.");
return;
}
ushort SendMap = client.Map.InheritanceMap;
GeneralDataPacket mapEnter = new GeneralDataPacket(Enums.DataAction.EnterMap)
{
Id = SendMap,
Data1 = SendMap,
Data3Low = client.X,
Data3High = client.Y
};
client.Send(mapEnter);
using (var mapinfo = new Packets.MapInfoPacket())
{
mapinfo.MapID = SendMap;
mapinfo.DocID = SendMap; // not entire sure what docid is, will figure this out later!
foreach (Enums.MapTypeFlags flag in client.Map.Flags.Values)
mapinfo.AddFlag(flag);
mapinfo.Finish();
client.Send(mapinfo);
}
}
示例6: Handle
/// <summary>
/// Handling the Marry action of the interaction packet.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="interact">The interaction packet.</param>
public static void Handle(Entities.GameClient client, InteractionPacket interact)
{
//uint marryUID = interact.TargetUID;
//Entities.GameClient marrytarget;
Maps.IMapObject obj;
if (client.Map.MapObjects.TryGetValue(interact.TargetUID, out obj))
{
Entities.GameClient spouse = obj as Entities.GameClient;
if (client.SpouseDatabaseUID > 0)
{
using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_SELF_SPOUSE))
client.Send(fmsg);
return;
}
if (spouse.SpouseDatabaseUID > 0)
{
using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_TARGET_SPOUSE))
client.Send(fmsg);
return;
}
client.SpouseDatabaseUID = spouse.DatabaseUID;
spouse.SpouseDatabaseUID = client.DatabaseUID;
//client.CharDB.AddSpouse(client.DatabaseUID, client.SpouseDatabaseUID);
//spouse.CharDB.AddSpouse(spouse.DatabaseUID, spouse.SpouseDatabaseUID);
Database.CharacterDatabase.AddSpouse(client, spouse);
using (var mate = new Packets.StringPacket(new StringPacker(spouse.Name)))
{
mate.Data = client.EntityUID;
mate.Action = Enums.StringAction.Mate;
client.Send(mate);
}
using (var mate = new Packets.StringPacket(new StringPacker(client.Name)))
{
mate.Data = spouse.EntityUID;
mate.Action = Enums.StringAction.Mate;
spouse.Send(mate);
}
using (var fireworks = new Packets.StringPacket(new StringPacker("firework-2love")))
{
fireworks.Action = Enums.StringAction.MapEffect;
fireworks.PositionX = client.X;
fireworks.PositionY = client.Y;
client.SendToScreen(fireworks, true);
fireworks.PositionX = spouse.X;
fireworks.PositionY = spouse.Y;
spouse.SendToScreen(fireworks, true);
}
using (var msg =Packets.Message.MessageCore.CreateSystem("ALL",
string.Format(Core.MessageConst.MARRIAGE_CONGRATZ, client.Name, spouse.Name)))
{
Packets.Message.MessageCore.SendGlobalMessage(msg);
}
}
}
示例7: Handle
public static void Handle(Entities.GameClient client, ItemPacket packet)
{
uint uid = packet.UID;
Data.Booth Booth = Data.Booth.FindBooth(uid);
if (Booth != null)
{
if (!Booth.ShopOwner.IsInMap(client))
return;
if (!Core.Screen.ValidDistance(client.X, client.Y, Booth.ShopOwner.X, Booth.ShopOwner.Y))
return;
Data.BoothItem boothItem;
if (Booth.BoothItems.TryGetValue(uid, out boothItem))
{
if (boothItem.IsCP && client.CPs < boothItem.Price)
{
using (var msg = Packets.Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.LOW_CPS))
client.Send(msg);
return;
}
else if (client.Money < boothItem.Price)
{
using (var msg = Packets.Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.LOW_MONEY2))
client.Send(msg);
return;
}
if (Booth.BoothItems.TryRemove(uid, out boothItem))
{
if (boothItem.IsCP)
{
client.CPs -= boothItem.Price;
Booth.ShopOwner.CPs += boothItem.Price;
}
else
{
client.Money -= boothItem.Price;
Booth.ShopOwner.Money += boothItem.Price;
}
client.Send(packet);
packet.Action = Enums.ItemAction.BoothDelete;
Booth.ShopOwner.Send(packet);
Data.ItemInfo item = Booth.ShopOwner.Inventory.RemoveItemByUID(uid);
client.Inventory.AddItem(item);
using (var msg = Packets.Message.MessageCore.CreateSystem(
Booth.ShopOwner.Name,
string.Format(Core.MessageConst.BOOTH_BUY, client.Name, item.Name)))
Booth.ShopOwner.Send(msg);
Database.CharacterDatabase.SaveInventory(client, item, client.Inventory.GetPositionFromItemUID(uid));
}
}
}
}
示例8: BeginTravel
public static void BeginTravel(Entities.GameClient client, ushort mapid, ushort x, ushort y, int secs = 40)
{
uint dynamicid;
Core.Kernel.Maps.selectorCollection1[999].CreateDynamic(out dynamicid);
client.TeleportDynamic(dynamicid, 70, 60);
int travelTime = (secs * 1000);
/*for (int i = 0; i < (travelTime / 1000); i++)
{
ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
{
using (var msg = Packets.Message.MessageCore.CreateCenter(
string.Format("Hitting destination in {0}", ((travelTime / 1000) - i))))
{
client.Send(msg);
}
}, 1000 * i);
}*/
int j = 0;
for (int i = secs; i > 0; i--)
{
int waitTime = (j * 1000);
string message = string.Format(Core.MessageConst.TRAVEL_TIME, i);
ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
{
using (var msg = Packets.Message.MessageCore.CreateCenter(
message))
{
client.Send(msg);
}
}, waitTime);
j++;
}
ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
{
using (var msg = Packets.Message.MessageCore.CreateCenter(
Core.MessageConst.TRAVEL_REACH))
{
client.Send(msg);
}
}, travelTime);
ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
{
client.Teleport(mapid, x, y);
using (var str = new Packets.StringPacket(new Packets.StringPacker("autorun_end")))
{
str.Action = Enums.StringAction.RoleEffect;
str.Data = client.EntityUID;
client.Send(str);
}
}, travelTime);
}
示例9: Handle
public static void Handle(Entities.GameClient client)
{
// Send vip, merchant, quiz points and heavenbless etc.
client.BaseEntity.SetBaseStats();
client.BaseEntity.CalculateBaseStats();
client.Stamina = 50;
client.PKPoints = client.PKPoints; // update status effect
client.BoundCPs = client.BoundCPs; // for some reason this has to be done here ...
using (ProjectX_V3_Lib.Sql.SqlHandler sql = Database.CharacterDatabase.OpenRead(client, "DB_Players"))
client.StatusFlag2 = sql.ReadUInt64("PlayerStatusFlag");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(Core.MessageConst.LOGIN_MSG, client.Name, client.Account, client.EntityUID, client.DatabaseUID);
Console.ResetColor();
MessagePacket bc = Threads.BroadcastThread.GetLastBroadcast();
if (bc != null)
{
client.Send(bc);
bc.Dispose();
}
Database.CharacterDatabase.LoadMessageQuery(client);
Data.NobilityBoard.SetNobility(client);
client.SendNobility();
client.SendSubClasses2();
Packets.UpdatePacket update = Packets.UpdatePacket.Create(client.EntityUID);
update.AddUpdate(Enums.UpdateType.VIPLevel, 6);
update.AddUpdate(Enums.UpdateType.Merchant, 255);
client.Send(update);
Data.ArenaQualifier.SetArenaInfo(client);
if (client.Arena == null)
{
client.Arena = new ProjectX_V3_Game.Data.ArenaInfo(client);
client.Arena.ArenaHonorPoints = 1000;
client.Arena.Level = (uint)client.Level;
client.Arena.Class = (uint)client.Class;
Database.ArenaDatabase.AddNewArenaInfo(client.Arena);
if (!Data.ArenaQualifier.AddArenaInfo(client.Arena))
{
client.NetworkClient.Disconnect("FAILED_TO_MAKE_ARENA_INFO");
return;
}
}
client.CanSave = true;
using (var motd = Packets.Message.MessageCore.CreateTalk(
Core.SystemVariables.Variables["ServerName"], client.Name,
Core.SystemVariables.ReplaceVariables(Program.Config.ReadString("MOTD"))))
client.Send(motd);
}
示例10: Handle
public static void Handle(Entities.GameClient client, DataPacket packet)
{
using (var arenaplayers = new ArenaPlayersPacket(Data.ArenaQualifier.GetTop10()))
{
client.Send(arenaplayers);
}
}
示例11: SendMessage
public void SendMessage(Entities.GameClient client, string Message)
{
using (var msg = Packets.Message.MessageCore.CreateCenter(Message))
{
client.Send(msg);
}
}
示例12: Handle
public static void Handle(Entities.GameClient client, ItemPacket packet)
{
if (client.Booth != null)
return;
packet.Data1 = client.WarehouseMoney;
client.Send(packet);
}
示例13: Handle
public static void Handle(Entities.GameClient client, StringPacket strings)
{
string Name = strings.Strings[0];
Entities.GameClient reqClient;
if (Core.Kernel.Clients.TrySelect(Name, out reqClient))
{
string toAdd = reqClient.EntityUID + " ";
toAdd += reqClient.Level + " ";
toAdd += reqClient.Level + " ";//battle power
toAdd += "# ";//unknown
toAdd += "# ";//unknown
toAdd += reqClient.SpouseName + " ";
toAdd += 0 + " ";//unknown
if (reqClient.Mesh % 10 < 3)
toAdd += "1 ";
else
toAdd += "0 ";
using (var newstrings = new StringPacket(new StringPacker(Name, toAdd)))
{
newstrings.Action = Enums.StringAction.WhisperWindowInfo;
client.Send(newstrings);
}
}
}
示例14: Handle
/// <summary>
/// Handling the Use action from the ItemPacket.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="item">The item packet.</param>
public static void Handle(Entities.GameClient client, ItemPacket packet)
{
uint uid = packet.UID;
if (client.Inventory.ContainsByUID(uid))
{
Data.ItemInfo useitem = client.Inventory[uid];
if (useitem.IsMisc())
{
if (!Core.Kernel.ItemScriptEngine.Invoke(useitem.ItemID, new object[] { client, useitem }))
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem(client.Name, string.Format(Core.MessageConst.INVALD_ITEM_USE, useitem.Name, useitem.ItemID)))
client.Send(fmsg);
}
}
else
{
if (!client.Alive)
return;
Enums.ItemLocation loc = (Enums.ItemLocation)packet.Data1;
client.Equipments.Equip(useitem, loc, true);
}
}
// else (Reason this is commented out is because it disconnected the client if switching equips too fast lmao.
// client.NetworkClient.Disconnect("Using invalid item.");
}
示例15: Handle
public static void Handle(Entities.GameClient client, DataPacket inPacket)
{
if (client.Trade.Trading)
return;
if (!client.Alive)
return;
using (var npcrequest = new NPCRequestPacket(inPacket))
{
try
{
if (npcrequest.Option == 255)
{
client.CurrentNPC = null;
return;
}
if (Core.Kernel.Shops.ContainsKey(npcrequest.NPCID))
{
if (!Core.Kernel.Shops[npcrequest.NPCID].AssociatedNPC.IsInMap(client))
{
return;
}
Packets.GeneralDataPacket pack = new Packets.GeneralDataPacket();
pack.Action = Enums.DataAction.OpenUpgrade;
pack.Id = client.EntityUID;
pack.Data1 = 32;
pack.Data3Low = client.X;
pack.Data3High = client.Y;
pack.Timestamp = npcrequest.NPCID;
client.Send(pack);
}
else
{
Entities.NPC npc = Core.Kernel.NPCs[npcrequest.NPCID];
if (!npc.IsInMap(client))
{
return;
}
if (Core.Screen.GetDistance(client.X, client.Y, npc.X, npc.Y) >= Core.NumericConst.MaxNPCDistance && npc.NPCType != Enums.NPCType.Distance)
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.TOO_FAR_NPC))
client.Send(fmsg);
return;
}
client.CurrentNPC = npc;
client.CurrentNPC.CallDialog(client, npcrequest.Option);
}
}
catch
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem(client.Name, string.Format("NPCID: {0}", npcrequest.NPCID)))
client.Send(fmsg);
}
}
}