本文整理匯總了C#中Server.Network.PacketHitList類的典型用法代碼示例。如果您正苦於以下問題:C# PacketHitList類的具體用法?C# PacketHitList怎麽用?C# PacketHitList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PacketHitList類屬於Server.Network命名空間,在下文中一共展示了PacketHitList類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckPlayerLevelUp
public static void CheckPlayerLevelUp(PacketHitList hitList, Client client)
{
PacketHitList.MethodStart(ref hitList);
if (client.Player.GetActiveRecruit().Exp > client.Player.GetActiveRecruit().GetNextLevel()) {
if (client.Player.GetActiveRecruit().Level < Exp.ExpManager.Exp.MaxLevels) {
Scripting.ScriptManager.InvokeSub("PlayerLevelUp", hitList, client);
hitList.AddPacketToMap(client.Player.Map, TcpPacket.CreatePacket("levelup", client.ConnectionID.ToString()));
//Messenger.SendDataToMap(client.Player.MapID, TcpPacket.CreatePacket("levelup", client.ConnectionID.ToString()));
}
if (client.Player.GetActiveRecruit().Level >= Exp.ExpManager.Exp.MaxLevels) {
client.Player.GetActiveRecruit().Level = Exp.ExpManager.Exp.MaxLevels;
client.Player.GetActiveRecruit().Exp = ExpManager.Exp[Exp.ExpManager.Exp.MaxLevels - 1];
}
} else {
PacketBuilder.AppendEXP(client, hitList);
//Messenger.SendEXP(client);
}
PacketHitList.MethodEnded(ref hitList);
//Messenger.SendActiveTeam(index);
//Messenger.SendHP(index);
//Messenger.SendStats(index);
//Messenger.BattleMsg(index, "You.", Text.BrightBlue);
}
示例2: AppendAdminMsg
public static void AppendAdminMsg(PacketHitList hitlist, string Msg, Color Color)
{
foreach (Client i in ClientManager.GetClients()) {
if (i.IsPlaying() && Ranks.IsAllowed(i, Enums.Rank.Moniter)) {
hitlist.AddPacket(i, TcpPacket.CreatePacket("msg", Msg, Color.ToArgb().ToString()));
}
}
}
示例3: DisplayInvisibleKeyTile
public static void DisplayInvisibleKeyTile(Client client, IMap map, int x, int y, PacketHitList packetList)
{
Tile tile = new Tile(new DataManager.Maps.Tile());
MapCloner.CloneTile(map, x, y, tile);
tile.Mask = 0;
tile.MaskSet = 4;
tile.Type = Enums.TileType.Walkable;
Messenger.SendTemporaryTileTo(packetList, client, x, y, tile);
}
示例4: MoveNpcDown
public static bool MoveNpcDown(IMap map, Client target, PacketHitList packetList, int mapNpcSlot)
{
// Down
if (map.ActiveNpc[mapNpcSlot].Y < target.Player.Y) {
if (MovementProcessor.CanNpcMove(map, mapNpcSlot, Enums.Direction.Down)) {
MovementProcessor.NpcMove(packetList, map, mapNpcSlot, map.ActiveNpc[mapNpcSlot].Direction, Enums.Speed.Walking);
return true;
}
}
return false;
}
示例5: CheckForSublevelGoal
public static void CheckForSublevelGoal(Client client, PacketHitList packetList)
{
for (int i = 0; i < client.Player.TriggerEvents.Count; i++) {
if (client.Player.TriggerEvents[i].Trigger == TriggerEventTrigger.SteppedOnTile &&
client.Player.TriggerEvents[i].ID.StartsWith("ESTSublevelGoal")) {
SteppedOnTileTriggerEvent tEvent = client.Player.TriggerEvents[i] as SteppedOnTileTriggerEvent;
if (client.Player.MapID == tEvent.MapID) {
DisplayVisibleSublevelGoalTile(client, client.Player.Map, tEvent.X, tEvent.Y, packetList);
}
}
}
}
示例6: AppendActiveTeam
public static void AppendActiveTeam(Client client, PacketHitList hitlist)
{
TcpPacket packet = new TcpPacket("activeteam");
Player player = client.Player;
for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
if (client.Player.Team[i].Loaded == true) {
packet.AppendParameters(player.Team[i].Name, player.Team[i].Species.ToString(), player.Team[i].Form.ToString(), ((int)player.Team[i].Shiny).ToString(), ((int)player.Team[i].Sex).ToString(),
player.Team[i].HP.ToString(), player.Team[i].MaxHP.ToString(),
Server.Math.CalculatePercent(player.Team[i].Exp, Exp.ExpManager.Exp[player.Team[i].Level - 1]).ToString(),
player.Team[i].Level.ToString(), ((int)player.Team[i].StatusAilment).ToString(), player.Team[i].HeldItemSlot.ToString());
} else {
packet.AppendParameter("notloaded");
}
}
packet.FinalizePacket();
hitlist.AddPacket(client, packet);
}
示例7: DisplayInvisibleSublevelGoalTile
public static void DisplayInvisibleSublevelGoalTile(Client client, IMap map, int x, int y, PacketHitList packetList)
{
PacketHitList.MethodStart(ref packetList);
Tile tile = new Tile(new DataManager.Maps.Tile());
MapCloner.CloneTile(map, x, y, tile);
tile.Mask = 0;
tile.MaskSet = 7;
tile.Type = Enums.TileType.Walkable;
Messenger.SendTemporaryTileTo(packetList, client, x, y, tile);
MapCloner.CloneTile(map, x, y - 1, tile);
tile.Fringe = 0;
tile.FringeSet = 7;
tile.Type = Enums.TileType.Walkable;
Messenger.SendTemporaryTileTo(packetList, client, x, y - 1, tile);
PacketHitList.MethodEnded(ref packetList);
}
示例8: MoveNpcInDirection
public static bool MoveNpcInDirection(Enums.Direction direction, IMap map, Client target, PacketHitList packetList, int mapNpcSlot)
{
switch (direction) {
case Enums.Direction.Up: {
return MoveNpcUp(map, target, packetList, mapNpcSlot);
}
case Enums.Direction.Down: {
return MoveNpcDown(map, target, packetList, mapNpcSlot);
}
case Enums.Direction.Left: {
return MoveNpcLeft(map, target, packetList, mapNpcSlot);
}
case Enums.Direction.Right: {
return MoveNpcRight(map, target, packetList, mapNpcSlot);
}
}
return false;
}
示例9: HandoutExp
public void HandoutExp(Client giver, ulong exp, PacketHitList hitlist)
{
PacketHitList.MethodStart(ref hitlist);
bool totalForAll = true;
ulong newExp;
if (totalForAll)
{
newExp = exp;
} else {
newExp = exp * (ulong)(Members.Count + 3) / 4 / (ulong)Members.Count;
}
if (!(giver.Player.GetActiveRecruit().Level == Exp.ExpManager.Exp.MaxLevels) && giver.Player.Hunted && !giver.Player.Dead) {
Scripting.ScriptManager.InvokeSub("PlayerEXP", hitlist, giver, newExp);
Combat.BattleProcessor.CheckPlayerLevelUp(hitlist, giver);
}
foreach (Client i in GetOnlineMemberClients()) {
if (i.IsPlaying() && i != giver) {
//PartyMember member = members.FindMember(i.Player.CharID);
//if (member != null) {
if (giver.Player.Map == i.Player.Map) {
if (!(i.Player.GetActiveRecruit().Level == Exp.ExpManager.Exp.MaxLevels) && i.Player.Hunted && !i.Player.Dead) {
int lowestBound = 8000;
int chosenMiddle = 8000;
if (i.Player.GetActiveRecruit().Level < giver.Player.GetActiveRecruit().Level) {
int diff = giver.Player.GetActiveRecruit().Level - i.Player.GetActiveRecruit().Level;
lowestBound -= diff * diff * 100 / 5;
int distance = Math.Max(Math.Abs(giver.Player.X - i.Player.X), Math.Abs(giver.Player.Y - i.Player.Y));
if (distance > 40)
distance = 40;
if (distance < 8)
distance = 8;
chosenMiddle = lowestBound * (distance - 8) / 40 + chosenMiddle * (40 - (distance - 8)) / 40;
if (chosenMiddle < 0) chosenMiddle = 0;
}
ulong moddedExp = newExp * (ulong)chosenMiddle / 8000;
if (moddedExp < 1) moddedExp = 1;
Scripting.ScriptManager.InvokeSub("PlayerEXP", hitlist, i, moddedExp);
Combat.BattleProcessor.CheckPlayerLevelUp(hitlist, i);
} else {
// The party member is at the max level, so do nothing
}
}
//}
}
}
PacketHitList.MethodEnded(ref hitlist);
}
示例10: HealCharacterBelly
private static void HealCharacterBelly(ICharacter character, int belly, PacketHitList hitlist)
{
if (character.CharacterType == Enums.CharacterType.Recruit) {
Recruit recruit = character as Recruit;
recruit.Belly += belly;
if (recruit.Belly >= recruit.MaxBelly) {
recruit.Belly = recruit.MaxBelly;
if (belly > 10) {
hitlist.AddPacketToMap(recruit.Owner.Player.Map, PacketBuilder.CreateBattleMsg(character.Name + "'s belly was filled completely.", Text.BrightGreen), character.X, character.Y, 10);
}
} else {
if (belly > 10) {
hitlist.AddPacketToMap(recruit.Owner.Player.Map, PacketBuilder.CreateBattleMsg(character.Name + "'s belly was filled somewhat.", Text.BrightGreen), character.X, character.Y, 10);
}
}
PacketBuilder.AppendBelly(((Recruit)character).Owner, hitlist);
}
}
示例11: HealCharacterPP
private static void HealCharacterPP(ICharacter character, IMap map, int pp, PacketHitList hitlist)
{
for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) {
if (character.Moves[i] != null) {
character.Moves[i].CurrentPP += pp;
if (character.Moves[i].CurrentPP > character.Moves[i].MaxPP) {
character.Moves[i].CurrentPP = character.Moves[i].MaxPP;
}
}
}
if (character.CharacterType == Enums.CharacterType.Recruit) {
PacketBuilder.AppendPlayerMoves(((Recruit)character).Owner, hitlist);
}
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s moves regained " + pp + " PP.", Text.BrightGreen), character.X, character.Y, 10);
}
示例12: DamageCharacter
private static void DamageCharacter(ICharacter character, IMap map, int dmg, Enums.KillType killType, PacketHitList hitlist, bool checkDeath)
{
int point = 0;
try {
character.HP -= dmg;
if (dmg <= 0) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " took no damage!", Text.BrightRed), character.X, character.Y, 10);
//BothWaysBattleMsg(setup, setup.Defender.Name + " took no damage!", Text.BrightRed);
} else {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " took " + dmg + " damage!", Text.BrightRed), character.X, character.Y, 10);
//BothWaysBattleMsg(setup, setup.Defender.Name + " took " + damage + " damage!", Text.BrightRed);
}
point = 1;
if (checkDeath && character.HP <= 0) {
if (character.CharacterType == Enums.CharacterType.Recruit) {
point = 2;
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Oh, no! " + character.Name + " fainted!", Text.BrightRed));
point = 3;
OnDeath(((Recruit)character).Owner, Enums.KillType.Other);
point = 4;
} else {
if (character.HeldItem != null) {
character.MapDropItem(character.HeldItem.Amount, null);
}
OnNpcDeath(hitlist, null, (MapNpc)character);
//((MapNpc)character).Num = 0;
//((MapNpc)character).HP = 0;
map.ActiveNpc[((MapNpc)character).MapSlot] = new MapNpc(character.MapID, ((MapNpc)character).MapSlot);
hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("npcdead", ((MapNpc)character).MapSlot));
}
}
} catch(Exception ex) {
Messenger.AdminMsg("Error: DamageCharacter", Text.Black);
Messenger.AdminMsg(ex.ToString(), Text.Black);
Messenger.AdminMsg(character.Name + " took " + dmg + " dmg at " + map.Name + " from " + killType + " with checkDeath=" + checkDeath + " and point=" + point, Text.Black);
throw new Exception();
}
}
示例13: HealCharacter
private static void HealCharacter(ICharacter character, IMap map, int hp, PacketHitList hitlist)
{
try {
if (character.VolatileStatus.GetStatus("HealBlock") != null) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " couldn't recover HP due to the Heal Block!", Text.BrightRed), character.X, character.Y, 10);
return;
}
if (character.HP + hp > character.MaxHP) {
hp = character.MaxHP - character.HP;
}
character.HP += hp;
if (hp <= 0) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s HP didn't change.", Text.BrightGreen), character.X, character.Y, 10);
//BothWaysBattleMsg(setup, setup.Defender.Name + " took no damage!", Text.BrightRed);
} else if (character.HP == character.MaxHP) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was fully healed!", Text.BrightGreen), character.X, character.Y, 10);
} else {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " recovered " + hp + " HP!", Text.BrightGreen), character.X, character.Y, 10);
//BothWaysBattleMsg(setup, setup.Defender.Name + " took " + damage + " damage!", Text.BrightRed);
}
} catch (Exception ex) {
Messenger.AdminMsg("Error: HealCharacter: " + character.Name, Text.Black);
Messenger.AdminMsg(ex.ToString(), Text.Black);
throw new Exception();
}
}
示例14: AppendOwnXY
public static void AppendOwnXY(Client client, PacketHitList hitlist)
{
hitlist.AddPacket(client, CreatePlayerXY(client));
client.Player.RefreshSeenCharacters(hitlist);
}
示例15: ReviveCharacter
public static void ReviveCharacter(ICharacter character, IMap map, bool fullHeal, PacketHitList hitlist)
{
try {
PacketHitList.MethodStart(ref hitlist);
if (fullHeal) {
character.HP = character.MaxHP;
for (int i = 0; i < character.Moves.Length; i++) {
character.Moves[i].CurrentPP = character.Moves[i].MaxPP;
}
if (character.CharacterType == Enums.CharacterType.Recruit) {
((Recruit)character).RestoreBelly();
}
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was fully revived!", Text.BrightGreen));
} else {
int hp = character.MaxHP / 2;
if (hp < 1) hp = 1;
character.HP = hp;
//restore belly to 20
if (character.CharacterType == Enums.CharacterType.Recruit) {
Recruit recruit = character as Recruit;
if (recruit.Belly < 25) {
recruit.Belly = 25;
PacketBuilder.AppendBelly(recruit.Owner, hitlist);
}
}
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was revived!", Text.BrightGreen));
}
hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic682.wav"), character.X, character.Y, 10);
hitlist.AddPacketToMap(map, PacketBuilder.CreateSpellAnim(509, character.X, character.Y));
if (character.CharacterType == Enums.CharacterType.Recruit) {
((Recruit)character).Owner.Player.Dead = false;
PacketBuilder.AppendDead(((Recruit)character).Owner, hitlist);
Messenger.ForceEndStoryTo(((Recruit)character).Owner);
}
RefreshCharacterMoves(character, map, hitlist);
PacketHitList.MethodEnded(ref hitlist);
} catch (Exception ex) {
Messenger.AdminMsg(ex.ToString(), Text.Black);
}
}