本文整理汇总了C#中Mooege.Net.GS.GameClient类的典型用法代码示例。如果您正苦于以下问题:C# GameClient类的具体用法?C# GameClient怎么用?C# GameClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameClient类属于Mooege.Net.GS命名空间,在下文中一共展示了GameClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConnect
public void OnConnect(object sender, ConnectionEventArgs e)
{
Logger.Trace("Game-Client connected: {0}", e.Connection.ToString());
var gameClient = new GameClient(e.Connection);
e.Connection.Client = gameClient;
}
示例2: SendMessage
public void SendMessage(GameClient client)
{
var list = GetMessageList();
foreach (var msg in list)
client.SendMessage(msg);
_changedAttributes.Clear();
}
示例3: Player
public Player(GameClient client, Universe universe, Toon bnetToon)
{
this.Client = client;
this.Universe = universe;
this.Hero = new Hero(client, universe, bnetToon);
}
示例4: OnJoinGame
private void OnJoinGame(GameClient client, JoinBNetGameMessage message)
{
var game = GameManager.GetGameById(message.GameId);
lock (game)
{
var toon = ToonManager.GetToonByLowID((ulong) message.ToonEntityId.Low);
client.Game = game;
if (toon.Owner.LoggedInClient == null)
{
Logger.Warn("Client doesn't seem to be connected to moonet, dropping him..");
client.Connection.Disconnect();
return; // if moonet connection is lost, don't allow him to get in.
}
// Set references between MooNetClient and GameClient.
client.BnetClient = toon.Owner.LoggedInClient;
client.BnetClient.InGameClient = client;
client.Player = new Player(game.StartWorld, client, toon);
Logger.Info("Player {0}[PlayerIndex: {1}] connected.", client.Player.Properties.Name, client.Player.PlayerIndex);
client.SendMessage(new VersionsMessage(message.SNOPackHash));
client.SendMessage(new ConnectionEstablishedMessage
{
PlayerIndex = client.Player.PlayerIndex,
Field1 = 0x4BB91A16,
SNOPackHash = message.SNOPackHash,
});
client.SendMessage(new GameSetupMessage // should be the current tick for the game /raist.
{
Field0 = game.Tick,
});
client.SendMessage(new SavePointInfoMessage
{
snoLevelArea = -1,
});
client.SendMessage(new HearthPortalInfoMessage
{
snoLevelArea = -1,
Field1 = -1,
});
// transition player to act so client can load act related data? /raist
client.SendMessage(new ActTransitionMessage
{
Field0 = 0x00000000,
Field1 = true,
});
game.Enter(client.Player);
}
}
示例5: Consume
public void Consume(GameClient client, GameMessage message)
{
if (message is AssignActiveSkillMessage) OnAssignActiveSkill(client, (AssignActiveSkillMessage)message);
else if (message is AssignPassiveSkillMessage) OnAssignPassiveSkill(client, (AssignPassiveSkillMessage)message);
else if (message is PlayerChangeHotbarButtonMessage) OnPlayerChangeHotbarButtonMessage(client, (PlayerChangeHotbarButtonMessage)message);
else return;
UpdateClient(client);
client.FlushOutgoingBuffer();
}
示例6: OnConnect
public static void OnConnect(object sender, ConnectionEventArgs e)
{
Logger.Trace("Game-Client connected: {0}", e.Connection.ToString());
// atm, just creating a universe - though clients should be able to join existing ones.
var universe = new Universe();
Universes.Add(universe);
var gameClient = new GameClient(e.Connection,universe);
e.Connection.Client = gameClient;
}
示例7: Route
public void Route(GameClient client, GameMessage message)
{
switch (message.Consumer)
{
case Consumers.Game:
this.Consume(client, message);
break;
case Consumers.Inventory:
client.Player.Inventory.Consume(client, message);
break;
case Consumers.Player:
client.Player.Consume(client, message);
break;
}
}
示例8: Route
public void Route(GameClient client, GameMessage message)
{
switch (message.Consumer)
{
case Consumers.Universe:
this.Consume(client, message);
break;
case Consumers.PlayerManager:
this.PlayerManager.Consume(client, message);
break;
case Consumers.Hero:
client.Player.Hero.Consume(client, message);
break;
}
}
示例9: Hero
public Hero(GameClient client, Universe universe, Toon toon)
{
this.InGameClient = client;
this.Universe = universe;
this.Properties = toon;
this.CurrentWorldSNO = 0x115EE;
this.Inventory = new Inventory(this);
this.SkillSet = new Skills.SkillSet(this.Properties.Class);
RevealedWorlds = new List<World>();
RevealedScenes = new List<Scene>();
RevealedActors = new List<Actor>();
// actor values
this.DynamicId = universe.NextObjectId;
this.SnoId = this.ClassSNO;
this.Field2 = 0x00000009;
this.Field3 = 0x00000000;
this.Scale = ModelScale;
this.RotationAmount = 0.05940768f;
this.RotationAxis = new Vector3D(0f, 0f, 0.9982339f);
//initial world and position
this.WorldId = 0x772E0000;
this.Position.X = 3143.75f;
this.Position.Y = 2828.75f;
this.Position.Z = 59.075588f;
//den of evil: this.Position.X = 2526.250000f; this.Position.Y = 2098.750000f; this.Position.Z = -5.381495f;
//inn: this.Position.X = 2996.250000f; this.Position.Y = 2793.750000f; this.Position.Z = 24.045330f;
// adrias hut: this.Position.X = 1768.750000f; this.Position.Y = 2921.250000f; this.Position.Z = 20.333143f;
// cemetry of forsaken: this.Position.X = 2041.250000f; this.Position.Y = 1778.750000f; this.Position.Z = 0.426203f;
//defiled crypt level 2: this.WorldId = 2000289804; this.Position.X = 158.750000f; this.Position.Y = 76.250000f; this.Position.Z = 0.100000f;
this.GBHandle = new GBHandle()
{
Field0 = 0x00000007,
Field1 = this.Properties.ClassID,
};
this.Field7 = -1;
this.Field8 = -1;
this.Field9 = 0x00000000;
this.Field10 = 0x0;
}
示例10: OnNewPlayer
public void OnNewPlayer(GameClient client, JoinBNetGameMessage message)
{
client.BnetClient = GameManager.AvailableGames[(ulong)message.GameId].Clients.FirstOrDefault();
if (client.BnetClient == null)
{
Logger.Warn("Couldn't find bnet client for joined client/player!");
return;
}
client.BnetClient.InGameClient = client;
var player = new Player(client, this.Universe, client.BnetClient.CurrentToon);
client.Player = player;
this.Players.Add(player);
player.Greet(message);
}
示例11: OnNewPlayer
public void OnNewPlayer(GameClient client, JoinBNetGameMessage message)
{
client.BnetClient = GameManager.AvailableGames[(ulong)message.GameId].Clients.FirstOrDefault();
if (client.BnetClient == null)
{
Logger.Warn("Couldn't find bnet client for joined client/player!");
return;
}
client.BnetClient.InGameClient = client;
client.SendMessageNow(new VersionsMessage(message.SNOPackHash));
client.SendMessage(new ConnectionEstablishedMessage
{
Field0 = 0x00000000,
Field1 = 0x4BB91A16,
SNOPackHash = message.SNOPackHash,
});
client.SendMessage(new GameSetupMessage
{
Field0 = 0x00000077,
});
client.SendMessage(new SavePointInfoMessage
{
snoLevelArea = -1,
});
client.SendMessage(new HearthPortalInfoMessage
{
snoLevelArea = -1,
Field1 = -1,
});
// transition player to act so client can load act related data? /raist
client.SendMessage(new ActTransitionMessage
{
Field0 = 0x00000000,
Field1 = true,
});
var player = new Mooege.Core.GS.Player.Player(this.Game.StartWorld, client, client.BnetClient.CurrentToon);
client.Player = player;
}
示例12: Consume
public void Consume(GameClient client, GameMessage message)
{
if (message is AssignActiveSkillMessage) OnAssignActiveSkill(client, (AssignActiveSkillMessage)message);
else if (message is AssignPassiveSkillMessage) OnAssignPassiveSkill(client, (AssignPassiveSkillMessage)message);
else if (message is PlayerChangeHotbarButtonMessage) OnPlayerChangeHotbarButtonMessage(client, (PlayerChangeHotbarButtonMessage)message);
else if (message is TargetMessage) OnObjectTargeted(client, (TargetMessage)message);
else if (message is PlayerMovementMessage) OnPlayerMovement(client, (PlayerMovementMessage)message);
else return;
UpdateState();
}
示例13: OnPlayerMovement
private void OnPlayerMovement(GameClient client, PlayerMovementMessage message)
{
// here we should also be checking the position and see if it's valid. If not we should be resetting player to a good position with ACDWorldPositionMessage
// so we can have a basic precaution for hacks & exploits /raist.
if (message.Position != null)
this.Position = message.Position;
var msg = new NotifyActorMovementMessage
{
ActorId = message.ActorId,
Position = this.Position,
Angle = message.Angle,
Field3 = false,
Field4 = message.Field4,
Field5 = message.Field5,
Field6 = message.Field6
};
this.World.BroadcastExclusive(msg, this); // TODO: We should be instead notifying currentscene we're in. /raist.
this.CollectGold();
this.CollectHealthGlobe();
}
示例14: Player
public Player(World world, GameClient client, Toon bnetToon)
: base(world, world.NewPlayerID)
{
this.InGameClient = client;
this.PlayerIndex = Interlocked.Increment(ref this.InGameClient.Game.PlayerIndexCounter); // make it atomic.
this.Properties = bnetToon;
this.Inventory = new Inventory(this);
this.SkillSet = new SkillSet(this.Properties.Class);
this.RevealedObjects = new Dictionary<uint, IRevealable>();
this.GroundItems = new Dictionary<uint, Item>();
// actor values
this.ActorSNO = this.ClassSNO;
this.Field2 = 0x00000009;
this.Field3 = 0x00000000;
this.Scale = ModelScale;
this.RotationAmount = 0.05940768f;
this.RotationAxis = new Vector3D(0f, 0f, 0.9982339f);
this.CollFlags = 0x00000000;
this.Position.X = 3143.75f;
this.Position.Y = 2828.75f;
this.Position.Z = 59.075588f;
// den of evil: this.Position.X = 2526.250000f; this.Position.Y = 2098.750000f; this.Position.Z = -5.381495f;
// inn: this.Position.X = 2996.250000f; this.Position.Y = 2793.750000f; this.Position.Z = 24.045330f;
// adrias hut: this.Position.X = 1768.750000f; this.Position.Y = 2921.250000f; this.Position.Z = 20.333143f;
// cemetery of the forsaken: this.Position.X = 2041.250000f; this.Position.Y = 1778.750000f; this.Position.Z = 0.426203f;
// defiled crypt level 2: this.WorldId = 2000289804; this.Position.X = 158.750000f; this.Position.Y = 76.250000f; this.Position.Z = 0.100000f;
this.GBHandle.Type = (int)GBHandleType.Player;
this.GBHandle.GBID = this.Properties.ClassID;
this.Field7 = -1;
this.Field8 = -1;
this.Field9 = 0x00000000;
this.Field10 = 0x0;
#region Attributes
this.Attributes[GameAttribute.SkillKit] = this.SkillKit;
this.Attributes[GameAttribute.Buff_Active, 0x33C40] = true;
this.Attributes[GameAttribute.Skill, 0x7545] = 1;
this.Attributes[GameAttribute.Skill_Total, 0x7545] = 1;
this.Attributes[GameAttribute.Resistance_Total, 0x226] = 0.5f;
this.Attributes[GameAttribute.Resistance, 0x226] = 0.5f;
this.Attributes[GameAttribute.Immobolize] = true;
this.Attributes[GameAttribute.Untargetable] = true;
this.Attributes[GameAttribute.Skill_Total, 0x76B7] = 1;
this.Attributes[GameAttribute.Skill, 0x76B7] = 1;
this.Attributes[GameAttribute.Skill, 0x6DF] = 1;
this.Attributes[GameAttribute.Buff_Active, 0xCE11] = true;
this.Attributes[GameAttribute.CantStartDisplayedPowers] = true;
this.Attributes[GameAttribute.Skill_Total, 0x216FA] = 1;
this.Attributes[GameAttribute.Skill, 0x176C4] = 1;
this.Attributes[GameAttribute.Skill, 0x216FA] = 1;
this.Attributes[GameAttribute.Skill_Total, 0x176C4] = 1;
this.Attributes[GameAttribute.Skill_Total, 0x6DF] = 1;
this.Attributes[GameAttribute.Resistance, 0xDE] = 0.5f;
this.Attributes[GameAttribute.Resistance_Total, 0xDE] = 0.5f;
this.Attributes[GameAttribute.Get_Hit_Recovery] = 6f;
this.Attributes[GameAttribute.Get_Hit_Recovery_Per_Level] = 1f;
this.Attributes[GameAttribute.Get_Hit_Recovery_Base] = 5f;
this.Attributes[GameAttribute.Skill, 0x7780] = 1;
this.Attributes[GameAttribute.Get_Hit_Max] = 60f;
this.Attributes[GameAttribute.Skill_Total, 0x7780] = 1;
this.Attributes[GameAttribute.Get_Hit_Max_Per_Level] = 10f;
this.Attributes[GameAttribute.Get_Hit_Max_Base] = 50f;
this.Attributes[GameAttribute.Resistance_Total, 0] = 3.051758E-05f; // im pretty sure key = 0 doesnt do anything since the lookup is (attributeId | (key << 12)), maybe this is some base resistance? /cm
this.Attributes[GameAttribute.Resistance_Total, 1] = 3.051758E-05f;
this.Attributes[GameAttribute.Resistance_Total, 2] = 3.051758E-05f;
this.Attributes[GameAttribute.Resistance_Total, 3] = 3.051758E-05f;
this.Attributes[GameAttribute.Resistance_Total, 4] = 3.051758E-05f;
this.Attributes[GameAttribute.Resistance_Total, 5] = 3.051758E-05f;
this.Attributes[GameAttribute.Resistance_Total, 6] = 3.051758E-05f;
this.Attributes[GameAttribute.Dodge_Rating_Total] = 3.051758E-05f;
this.Attributes[GameAttribute.IsTrialActor] = true;
this.Attributes[GameAttribute.Buff_Visual_Effect, 0xFFFFF] = true;
this.Attributes[GameAttribute.Crit_Percent_Cap] = 0x3F400000;
this.Attributes[GameAttribute.Resource_Cur, this.ResourceID] = 200f;
this.Attributes[GameAttribute.Resource_Max, this.ResourceID] = 200f;
this.Attributes[GameAttribute.Resource_Max_Total, this.ResourceID] = 200f;
this.Attributes[GameAttribute.Damage_Weapon_Min_Total_All] = 2f;
this.Attributes[GameAttribute.Damage_Weapon_Delta_Total_All] = 1f;
this.Attributes[GameAttribute.Resource_Regen_Total, this.ResourceID] = 3.051758E-05f;
this.Attributes[GameAttribute.Resource_Effective_Max, this.ResourceID] = 200f;
this.Attributes[GameAttribute.Damage_Min_Subtotal, 0xFFFFF] = 3.051758E-05f;
this.Attributes[GameAttribute.Damage_Min_Total, 0xFFFFF] = 3.051758E-05f;
this.Attributes[GameAttribute.Damage_Weapon_Min_Total_CurrentHand, 0xFFFFF] = 3.051758E-05f;
this.Attributes[GameAttribute.Attacks_Per_Second_Item_CurrentHand] = 1.199219f;
this.Attributes[GameAttribute.Attacks_Per_Second_Item_Total_MainHand] = 1.199219f;
this.Attributes[GameAttribute.Attacks_Per_Second_Total] = 1.199219f;
this.Attributes[GameAttribute.Attacks_Per_Second] = 1f;
this.Attributes[GameAttribute.Attacks_Per_Second_Item_MainHand] = 1.199219f;
this.Attributes[GameAttribute.Attacks_Per_Second_Item_Total] = 1.199219f;
this.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00033C40] = 0x000003FB;
this.Attributes[GameAttribute.Attacks_Per_Second_Item_Subtotal] = 3.051758E-05f;
this.Attributes[GameAttribute.Attacks_Per_Second_Item] = 3.051758E-05f;
this.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00033C40] = 0x00000077;
//.........这里部分代码省略.........
示例15: Consume
public void Consume(GameClient client, GameMessage message)
{
if (message is InventoryRequestMoveMessage) HandleInventoryRequestMoveMessage(message as InventoryRequestMoveMessage);
else if (message is InventorySplitStackMessage) OnInventorySplitStackMessage(message as InventorySplitStackMessage);
else if (message is InventoryStackTransferMessage) OnInventoryStackTransferMessage(message as InventoryStackTransferMessage);
else if (message is InventoryDropItemMessage) OnInventoryDropItemMessage(message as InventoryDropItemMessage);
else if (message is InventoryRequestUseMessage) OnInventoryRequestUseMessage(message as InventoryRequestUseMessage);
else return;
}