本文整理匯總了C#中Server.Network.PacketHitList.AddPacketToMap方法的典型用法代碼示例。如果您正苦於以下問題:C# PacketHitList.AddPacketToMap方法的具體用法?C# PacketHitList.AddPacketToMap怎麽用?C# PacketHitList.AddPacketToMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Network.PacketHitList
的用法示例。
在下文中一共展示了PacketHitList.AddPacketToMap方法的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: InvDrop
private static void InvDrop(ICharacter character, IMap map, PacketHitList hitlist)
{
PacketHitList.MethodStart(ref hitlist);
if (HasAbility(character, "Sticky Hold")) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " held on to its item with Sticky Hold!", Text.WhiteSmoke), character.X, character.Y, 10);
} else {
if (character.CharacterType == Enums.CharacterType.Recruit) {
Client client = ((Recruit)character).Owner;
if (client.Player.GetActiveRecruit().HeldItemSlot > -1) {
client.Player.DropItem(client.Player.GetActiveRecruit().HeldItemSlot, client.Player.GetActiveRecruit().HeldItem.Amount, client);
}
PacketBuilder.AppendInventory(client, hitlist);
} else if (character.CharacterType == Enums.CharacterType.MapNpc) {
MapNpc npc = character as MapNpc;
if (npc.HeldItem != null && !npc.HeldItem.Sticky) {
npc.MapDropItem(npc.HeldItem.Amount, null);
}
}
}
PacketHitList.MethodEnded(ref hitlist);
}
示例3: 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);
}
}
示例4: 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();
}
}
示例5: OnNpcDeath
public static void OnNpcDeath(PacketHitList hitlist, ICharacter attacker, MapNpc npc)
{
try {
// Called when a npc faints
PacketHitList.MethodStart(ref hitlist);
hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateBattleMsg(npc.Name + " fainted!", Text.WhiteSmoke), npc.X, npc.Y, 10);
//aftermath
if (HasAbility(npc, "Aftermath")) {
bool explode = true;
if (!HasAbility(npc, "Mold Breaker")) {
TargetCollection checkedTargets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, MapManager.RetrieveActiveMap(npc.MapID), null, 0, 0, Enums.Direction.Up, true, true, false);
for (int i = 0; i < checkedTargets.Count; i++) {
if (HasAbility(checkedTargets[i], "Damp")) {
explode = false;
}
}
}
if (explode) {
hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateBattleMsg(npc.Name + " exploded!", Text.BrightRed), npc.X, npc.Y, 10);
hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSoundPacket("magic216.wav"), npc.X, npc.Y, 10);
for (int i = npc.X - 1; i <= npc.X + 1; i++) {
for (int j = npc.Y - 1; j <= npc.Y + 1; j++) {
if (i < 0 || j < 0 || i > MapManager.RetrieveActiveMap(npc.MapID).MaxX || j > MapManager.RetrieveActiveMap(npc.MapID).MaxY) {
} else {
hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSpellAnim(497, i, j));
}
}
}
TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Room, 1, MapManager.RetrieveActiveMap(npc.MapID), npc, npc.X, npc.Y, Enums.Direction.Up, true, true, false);
for (int i = 0; i < targets.Count; i++) {
if (MapManager.RetrieveActiveMap(npc.MapID).Moral == Enums.MapMoral.None) {
if (targets[i].HP > 0) {
if (HasActiveBagItem(targets[i], 6, 0, 0)) {
DamageCharacter(targets[i], MapManager.RetrieveActiveMap(targets[i].MapID), 1, Enums.KillType.Tile, hitlist, true);
} else {
DamageCharacter(targets[i], MapManager.RetrieveActiveMap(targets[i].MapID), targets[i].MaxHP / 4, Enums.KillType.Tile, hitlist, true);
}
}
}
}
} else {
hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSoundPacket("magic320.wav"), npc.X, npc.Y, 10);
hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSpellAnim(505, npc.X, npc.Y));
hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateBattleMsg("The damp conditions prevented an explosion!", Text.Blue), npc.X, npc.Y, 10);
}
}
//death flag
TargetCollection witnesses = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, MapManager.RetrieveActiveMap(npc.MapID), npc, 0, 0, Enums.Direction.Up, false, true, false);
for (int i = 0; i < witnesses.Count; i++) {
AddExtraStatus(witnesses[i], MapManager.RetrieveActiveMap(npc.MapID), "SawAllyFaint", 0, null, "", hitlist);
}
RemoveAllBondedExtraStatus(npc, MapManager.RetrieveActiveMap(npc.MapID), hitlist, false);
IMap map = MapManager.RetrieveActiveMap(npc.MapID);
Client client = null;
foreach (Client n in map.GetClients()) {
client = n;
break;
}
if (client != null) {
bool doBossCheck = false;
switch (npc.Num) {
/*
case 276:
case 277:
case 278: { //Dynamo Trio
map.RemoveNpc(npc.MapSlot);
if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3)) {
map.Tile[9, 1].Mask = 96;
map.Tile[9, 1].MaskSet = 4;
map.Tile[9, 1].Type = Enums.TileType.Scripted;
map.Tile[9, 1].Data1 = 46;
map.Tile[9, 1].Data2 = 0;
map.Tile[9, 1].Data3 = 0;
map.Tile[9, 1].String1 = "19";
map.Tile[9, 1].String2 = "1";
map.Tile[9, 1].String3 = "10:7";
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 1, map));
}
}
break;
*/
case 304: {//registeel
map.RemoveNpc(npc.MapSlot);
if (map.IsNpcSlotEmpty(5)) {
BossBattles.EndRegisteelBattle(client);
}
}
break;/*
case 305: {//bronzong
//.........這裏部分代碼省略.........
示例6: AppendPlayerDir
public static void AppendPlayerDir(Client client, PacketHitList hitlist)
{
hitlist.AddPacketToMap(client.Player.Map, CreatePlayerDir(client));
}
示例7: AddMapStatus
public static void AddMapStatus(IMap map, string name, int counter, string tag, int graphicEffect, bool msg, PacketHitList hitlist)
{
if (map.TempStatus.GetStatus(name) == null) {
map.TempStatus.Add(new MapStatus(name, counter, tag, graphicEffect));
if (msg) {
switch (name) {
case "TrickRoom": {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The floor's dimensions were twisted!", Text.BrightBlue));
}
break;
case "Gravity": {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The floor's gravity intensified!", Text.BrightBlue));
TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, null, 0, 0, Enums.Direction.Up, true, true, false);
for (int i = 0; i < targets.Count; i++) {
DropToGround(targets[i], map, hitlist, false);
}
}
break;
case "WonderRoom": {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("All physical and special attacks changed properties!", Text.BrightBlue));
}
break;
case "MagicRoom": {
TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, null, 0, 0, Enums.Direction.Up, true, true, false);
for (int i = 0; i < targets.Count; i++) {
targets[i].RefreshActiveItemList();
}
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("All items lost their effects!", Text.BrightBlue));
}
break;
case "Luminous": {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The entire floor was illuminated!", Text.BrightBlue));
}
break;
}
}
RefreshMapTraits(map, hitlist);
}
}
示例8: SetStatusAilment
//only for active recruits
public static void SetStatusAilment(ICharacter character, ICharacter attacker, IMap map, Enums.StatusAilment statusAilment, int counter, PacketHitList hitlist)
{
PacketHitList.MethodStart(ref hitlist);
//Check against status protection
if (CheckStatusProtection(character, attacker, map, statusAilment.ToString() + ":" + counter, true, hitlist)) {
PacketHitList.MethodEnded(ref hitlist);
return;
}
switch (statusAilment) {
case Enums.StatusAilment.OK: {
switch (character.StatusAilment) {
case Enums.StatusAilment.Burn: {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " recovered from the burn!", Text.BrightCyan), character.X, character.Y, 10);
}
break;
case Enums.StatusAilment.Freeze: {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " thawed out!", Text.BrightCyan), character.X, character.Y, 10);
}
break;
case Enums.StatusAilment.Paralyze: {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " recovered from paralysis!", Text.BrightCyan), character.X, character.Y, 10);
}
break;
case Enums.StatusAilment.Poison: {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " recovered from the poisoning!", Text.BrightCyan), character.X, character.Y, 10);
}
break;
case Enums.StatusAilment.Sleep: {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " woke up!", Text.BrightCyan), character.X, character.Y, 10);
}
break;
}
character.StatusAilment = Enums.StatusAilment.OK;
character.StatusAilmentCounter = 0;
}
break;
case Enums.StatusAilment.Burn: {
character.StatusAilment = Enums.StatusAilment.Burn;
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " sustained a burn!", Text.BrightRed), character.X, character.Y, 10);
}
break;
case Enums.StatusAilment.Freeze: {
character.StatusAilment = Enums.StatusAilment.Freeze;
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was frozen solid!", Text.BrightRed), character.X, character.Y, 10);
}
break;
case Enums.StatusAilment.Paralyze: {
character.StatusAilment = Enums.StatusAilment.Paralyze;
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " became paralyzed!", Text.BrightRed), character.X, character.Y, 10);
}
break;
case Enums.StatusAilment.Poison: {
if (counter > 1) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was badly poisoned!", Text.BrightRed), character.X, character.Y, 10);
} else if (counter == 1) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was poisoned!", Text.BrightRed), character.X, character.Y, 10);
}
character.StatusAilment = Enums.StatusAilment.Poison;
character.StatusAilmentCounter = counter;
}
break;
case Enums.StatusAilment.Sleep: {
character.StatusAilment = Enums.StatusAilment.Sleep;
character.StatusAilmentCounter = counter;
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " fell asleep!", Text.BrightRed), character.X, character.Y, 10);
}
break;
}
if (character.VolatileStatus.GetStatus("Yawn") != null) {
RemoveExtraStatus(character, map, "Yawn", hitlist);
}
if (character.CharacterType == Enums.CharacterType.Recruit) {
PacketBuilder.AppendStatusAilment(((Recruit)character).Owner, hitlist);
} else {
PacketBuilder.AppendNpcStatusAilment((MapNpc)character, hitlist);
}
RefreshCharacterTraits(character, map, hitlist);
if (attacker != null && statusAilment != Enums.StatusAilment.OK) {
if (HasAbility(character, "Synchronize")) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Synchronize shared the status problem!", Text.BrightRed), character.X, character.Y, 10);
SetStatusAilment(attacker, map, statusAilment, counter, hitlist);
}
}
PacketHitList.MethodEnded(ref hitlist);
}
示例9: RevealTrap
public static void RevealTrap(IMap map, int x, int y, PacketHitList hitlist)
{
PacketHitList.MethodStart(ref hitlist);
map.Tile[x, y].Data2++;
if (map.Tile[x, y].Data3 == 1) {//fake stairs
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("It's not a stairway! It's a trap!", Text.BrightRed), x, y, 10);
}
switch (map.Tile[x, y].Data1) {
case 2: {//EXPLOSIONNNNN
map.Tile[x, y].Mask2 = 3995;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 3: {//chestnut
map.Tile[x, y].Mask2 = 3997;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 4: {//ppzero
map.Tile[x, y].Mask2 = 4000;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 5: {//grimy
map.Tile[x, y].Mask2 = 3999;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 6: {//poison
map.Tile[x, y].Mask2 = 3993;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 7: {//random
map.Tile[x, y].Mask2 = 4011;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 15: {//warp
map.Tile[x, y].Mask2 = 3;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 16: {//pokemon
map.Tile[x, y].Mask2 = 4007;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 17: {//spikes
map.Tile[x, y].Mask2 = 4009;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 18: {//toxic spikes
map.Tile[x, y].Mask2 = 4008;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 19: {//stealth rock
map.Tile[x, y].Mask2 = 4010;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 23: {//sticky
map.Tile[x, y].Mask2 = 3998;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 25: {//mud
map.Tile[x, y].Mask2 = 3991;
map.Tile[x, y].Mask2Set = 4;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
}
break;
case 26: {//wonder tile
//.........這裏部分代碼省略.........
示例10: RemoveTrap
public static void RemoveTrap(IMap map, int x, int y, PacketHitList hitlist)
{
PacketHitList.MethodStart(ref hitlist);
map.Tile[x, y].Type = Enums.TileType.Walkable;
map.Tile[x, y].Data1 = 0;
map.Tile[x, y].Data2 = 0;
map.Tile[x, y].Data3 = 0;
map.Tile[x, y].String1 = "";
map.Tile[x, y].String2 = "";
map.Tile[x, y].String3 = "";
map.Tile[x, y].Mask2 = 0;
map.Tile[x, y].Mask2Set = 0;
map.TempChange = true;
hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
PacketHitList.MethodEnded(ref hitlist);
}
示例11: RandomWarp
public static void RandomWarp(ICharacter character, IMap warpMap, bool msg, PacketHitList hitlist, int startX, int endX, int startY, int endY)
{
if (HasAbility(character, "Suction Cups")) {
if (msg) {
hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Suction Cups prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
}
} else if (character.HasActiveItem(111)) {
if (msg) {
hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Iron Ball prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
}
} else {
PacketHitList.MethodStart(ref hitlist);
if (startX < 0) startX = 0;
if (startX > warpMap.MaxX) startX = warpMap.MaxX;
if (endX < 0) endX = 0;
if (endX > warpMap.MaxX) endX = warpMap.MaxX;
if (startY < 0) startY = 0;
if (startY > warpMap.MaxY) startY = warpMap.MaxY;
if (endY < 0) endY = 0;
if (endY > warpMap.MaxY) endY = warpMap.MaxY;
int x, y;
FindFreeTile(warpMap, startX, startY, endX, endY, out x, out y);
if (x == -1) {
if (msg) {
hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + " didn't warp.", Text.BrightRed), character.X, character.Y, 10);
}
} else {
PointWarp(character, warpMap, hitlist, x, y);
}
PacketHitList.MethodEnded(ref hitlist);
}
}
示例12: Pounce
public static void Pounce(ICharacter character, IMap map, Enums.Direction dir, bool checkAllies, bool checkFoes, PacketHitList hitlist)
{
WarpToNearestWallOrChar(character, map, dir, checkAllies, checkFoes, hitlist);
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " went flying forward!", Text.WhiteSmoke), character.X, character.Y, 10);
}
示例13: PointWarp
public static void PointWarp(ICharacter character, IMap warpMap, PacketHitList hitlist, int X, int Y, bool msg)
{
if (HasAbility(character, "Suction Cups")) {
if (msg) {
hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Suction Cups prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
}
} else if (character.HasActiveItem(111)) {
if (msg) {
hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Iron Ball prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
}
} else {
PacketHitList.MethodStart(ref hitlist);
if (msg) {
hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + " warped!", Text.WhiteSmoke), character.X, character.Y, 10);
}
character.X = X;
character.Y = Y;
if (character.CharacterType == Enums.CharacterType.Recruit) {
PacketBuilder.AppendPlayerXY(((Recruit)character).Owner, hitlist);
} else if (character.CharacterType == Enums.CharacterType.MapNpc) {
PacketBuilder.AppendNpcXY(warpMap, hitlist, ((MapNpc)character).MapSlot);
}
PacketHitList.MethodEnded(ref hitlist);
}
}
示例14: OnStep
public static void OnStep(IMap map, ICharacter character, Enums.Speed speed, PacketHitList hitlist)
{
try {
ExtraStatus status;
PacketHitList.MethodStart(ref hitlist);
if (speed != Enums.Speed.Slip) {
int stepCounter;
if (character.CharacterType == Enums.CharacterType.Recruit) {
((Recruit)character).Owner.Player.HPStepCounter++;
if (((Recruit)character).Owner.Player.Map.HungerEnabled) {
if (character.HasActiveItem(151)) {
((Recruit)character).Owner.Player.BellyStepCounter += 5;
} else if (character.HasActiveItem(152)) {
//nothing
} else if (character.HasActiveItem(162)) {
((Recruit)character).Owner.Player.BellyStepCounter += 20;
} else {
((Recruit)character).Owner.Player.BellyStepCounter += 10;
}
if (HasAbility(character, "Gluttony")) {
((Recruit)character).Owner.Player.BellyStepCounter += 10;
}
}
stepCounter = ((Recruit)character).Owner.Player.HPStepCounter;
ElectrostasisTower.OnPlayerStep(((Recruit)character).Owner);
if (stepCounter % 5 == 0) {
if (map.MapID == MapManager.GenerateMapID(737)) {
bool hasBeenWelcomed = ((Recruit)character).Owner.Player.StoryHelper.ReadSetting("[Gameplay]-HasBeenWelcomed").ToBool();
if (!hasBeenWelcomed) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateChatMsg(((Recruit)character).Owner.Player.Name + " is new to " + Settings.GameNameShort + "! Welcome!", Text.BrightGreen));
((Recruit)character).Owner.Player.StoryHelper.SaveSetting("[Gameplay]-HasBeenWelcomed", "True");
}
}
}
} else {
((MapNpc)character).HPStepCounter++;
stepCounter = ((MapNpc)character).HPStepCounter;
}
if (MapManager.IsMapActive(character.MapID)) {
RemoveExtraStatus(character, map, "Roost", hitlist);
RemoveExtraStatus(character, map, "Endure", hitlist);
RemoveExtraStatus(character, map, "DestinyBond", hitlist);
status = character.VolatileStatus.GetStatus("Rage");
if (status != null) {
status.Counter--;
if (status.Counter <= 0) {
RemoveExtraStatus(character, map, "Rage", hitlist);
}
}
status = character.VolatileStatus.GetStatus("MetalBurst");
if (status != null) {
status.Counter--;
if (status.Counter <= 0) {
RemoveExtraStatus(character, map, "MetalBurst", hitlist);
}
}
//if (character.VolatileStatus.GetStatus("Taunt") != null) {
// character.VolatileStatus.GetStatus("Taunt").Counter--;
// if (character.VolatileStatus.GetStatus("Taunt").Counter <= 0) {
// RemoveExtraStatus(character, map, "Taunt", hitlist);
// }
//}
Tile steppedTile = map.Tile[character.X, character.Y];
if (steppedTile.Type == Enums.TileType.MobileBlock) {
if (steppedTile.Data1 % 32 >= 16) {
if (character.CharacterType == Enums.CharacterType.Recruit) {
if (((Recruit)character).Owner.Player.Map.HungerEnabled && character.VolatileStatus.GetStatus("SuperMobile") == null) {
((Recruit)character).Owner.Player.BellyStepCounter += 400;
}
}
} else if (steppedTile.Data1 % 4 >= 2) {
if (steppedTile.String1 == "1") {
if (!CheckStatusProtection(character, map, Enums.StatusAilment.Burn.ToString(), false, hitlist)) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water's boiling hot!", Text.BrightRed), character.X, character.Y, 10);
SetStatusAilment(character, map, Enums.StatusAilment.Burn, 0, hitlist);
}
} else if (steppedTile.String1 == "2") {
if (!CheckStatusProtection(character, map, Enums.StatusAilment.Freeze.ToString(), false, hitlist)) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water's freezing cold!", Text.BrightRed), character.X, character.Y, 10);
SetStatusAilment(character, map, Enums.StatusAilment.Freeze, 0, hitlist);
}
} else if (steppedTile.String1 == "3") {
if (!CheckStatusProtection(character, map, Enums.StatusAilment.Paralyze.ToString(), false, hitlist)) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water is numbing!", Text.BrightRed), character.X, character.Y, 10);
SetStatusAilment(character, map, Enums.StatusAilment.Paralyze, 0, hitlist);
}
} else if (steppedTile.String1 == "4") {
if (!CheckStatusProtection(character, map, Enums.StatusAilment.Poison.ToString(), false, hitlist)) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water's poisoned!", Text.BrightRed), character.X, character.Y, 10);
SetStatusAilment(character, map, Enums.StatusAilment.Poison, 1, hitlist);
}
} else if (steppedTile.String1 == "5") {
if (!CheckStatusProtection(character, map, Enums.StatusAilment.Sleep.ToString(), false, hitlist)) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water is oddly calming...", Text.BrightRed), character.X, character.Y, 10);
SetStatusAilment(character, map, Enums.StatusAilment.Sleep, 3, hitlist);
//.........這裏部分代碼省略.........
示例15: Sticky
private static void Sticky(ICharacter character, IMap map, PacketHitList hitlist)
{
PacketHitList.MethodStart(ref hitlist);
if (character.HasActiveItem(421)) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s No-Stick Cap prevented any items from becoming sticky!", Text.WhiteSmoke), character.X, character.Y, 10);
} else {
if (character.CharacterType == Enums.CharacterType.Recruit) {
Client client = ((Recruit)character).Owner;
List<int> itemsToCheck = new List<int>();
for (int i = 1; i <= client.Player.MaxInv; i++) {
if (client.Player.Inventory[i].Num > 0 && !client.Player.Inventory[i].Sticky) {
itemsToCheck.Add(i);
}
}
if (itemsToCheck.Count > 0) {
int stickySlot = itemsToCheck[Server.Math.Rand(0, itemsToCheck.Count)];
if (client.Player.Inventory[stickySlot].Num > 0 && !client.Player.Inventory[stickySlot].Sticky) {
client.Player.SetItemSticky(stickySlot, true);
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s " + ItemManager.Items[client.Player.Inventory[stickySlot].Num].Name + " became sticky!", Text.BrightRed), character.X, character.Y, 10);
} else {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Nothing particularly bad happened to " + character.Name + "...", Text.Blue), character.X, character.Y, 10);
}
} else {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Nothing particularly bad happened to " + character.Name + "...", Text.Blue), character.X, character.Y, 10);
}
} else if (character.CharacterType == Enums.CharacterType.MapNpc) {
MapNpc npc = character as MapNpc;
if (npc.HeldItem != null && !npc.HeldItem.Sticky) {
npc.HeldItem.Sticky = true;
if (npc.ActiveItems.Contains(npc.HeldItem.Num)) {
npc.RemoveFromActiveItemList(npc.HeldItem.Num);
}
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s " + ItemManager.Items[npc.HeldItem.Num].Name + " became sticky!", Text.BrightRed), character.X, character.Y, 10);
} else {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Nothing particularly bad happened to " + character.Name + "...", Text.Blue), character.X, character.Y, 10);
}
}
}
PacketHitList.MethodEnded(ref hitlist);
}