public static Character FindTargetInNextCells(Character ch, string targetName) { int SubStrLen = 0; int bitcount = 0; Cell curCell = null; //loop through all visable cells for (int ypos = -1; ypos <= 1; ypos += 1) { for (int xpos = -1; xpos <= 1; xpos += 1) { curCell = Cell.GetCell(ch.FacetID, ch.LandID, ch.MapID, ch.X + xpos, ch.Y + ypos, ch.Z); //Look for the character in the charlist of the cell foreach (Character chr in curCell.Characters.Values) { if (chr.Name.Length < targetName.Length) { continue; } SubStrLen = targetName.Length; //compare the substring against the targetName and see if we find a match if (chr.Name.ToLower().Substring(0, SubStrLen) == targetName.ToLower() && chr != ch) { return(chr); } } bitcount += 1; } } return(null); }
public static Item[] GetAllItemsFromGround(Cell groundCell) { Item[] tempItemList = new Item[groundCell.Items.Count]; groundCell.Items.CopyTo(tempItemList, 0); foreach (Item item in tempItemList) { groundCell.Remove(item); } return(tempItemList); }
public static bool IsItemOnGround(int itemID, Cell cell) { foreach (Item item in cell.Items) { if (item.itemID == itemID) { return(true); } } return(false); }
public static bool IsItemOnGround(string itemName, int facet, int land, int map, int xcord, int ycord, int zcord) { foreach (Item item in Cell.GetCell(facet, land, map, xcord, ycord, zcord).Items) { if (item.name.ToLower() == itemName.ToLower() || (int.TryParse(itemName, out int uniqueID) && uniqueID == item.UniqueID)) { return(true); } } return(false); }
public static Item FindItemOnGround(int itemID, Cell groundCell) { foreach (Item item in groundCell.Items) { if (item.itemID == itemID || item.UniqueID == itemID) { return(item); } } return(null); }
public static Item RemoveItemFromGround(string itemName, Cell groundCell) { foreach (Item item in new List <Item>(groundCell.Items)) { if (item.name.ToLower() == itemName.ToLower() || (int.TryParse(itemName, out int uniqueID) && uniqueID == item.UniqueID)) { groundCell.Remove(item); return(item); } } return(null); }
// Return an item on ground, remove it from cell public static Item RemoveItemFromGround(string itemname, int facet, int land, int map, int xcord, int ycord, int zcord) { foreach (Item item in Cell.GetCell(facet, land, map, xcord, ycord, zcord).Items) { if (item.name.ToLower() == itemname.ToLower() || (int.TryParse(itemname, out int uniqueID) && uniqueID == item.UniqueID)) { Cell.GetCell(facet, land, map, xcord, ycord, zcord).Remove(item); return(item); } }//end foreach return(null); }
/// <summary> /// Not currently used. /// </summary> /// <param name="cell"></param> /// <param name="worldNPCID"></param> /// <returns></returns> public static Character FindTargetInCell(Cell cell, long worldNPCID) { foreach (Character chr in cell.Characters.Values) { if (chr is NPC && chr.UniqueID == worldNPCID) { return(chr); } } return(null); }
public bool SuccessfulPathTest(Cell targetCell) { if (this.CurrentCell == null || targetCell == null) { return(false); } if (this.CurrentCell == targetCell) { return(true); } return(this.BuildMoveList(targetCell.X, targetCell.Y, targetCell.Z)); }
public bool OnCast(Character caster, string args) { args = args.Replace(" at ", ""); Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); int duration = 3; // 3 rounds, base if (caster.species == Globals.eSpecies.Arachnid || Autonomy.EntityBuilding.EntityLists.ARACHNID.Contains(caster.entity)) { duration += caster.Level / 2; } else if (caster.IsSpellWarmingProfession && caster.preppedSpell == GameSpell.GetSpell((int)GameSpell.GameSpellID.Create_Web)) { duration += Skills.GetSkillLevel(caster.magic) / 3; } duration += Rules.Dice.Next(-1, 1); if (target == null) { Cell targetCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, false); if (targetCell != null) { AreaEffect effect = new AreaEffect(Effect.EffectTypes.Web, Cell.GRAPHIC_WEB, Skills.GetSkillLevel(caster.magic), duration, caster, targetCell); targetCell.EmitSound(ReferenceSpell.SoundFile); } } else { AreaEffect effect = new AreaEffect(Effect.EffectTypes.Web, Cell.GRAPHIC_WEB, Skills.GetSkillLevel(caster.magic), duration, caster, target.CurrentCell); if (target.CurrentCell != null) { target.CurrentCell.EmitSound(ReferenceSpell.SoundFile); } } if (target == null) { caster.WriteToDisplay("You cast " + ReferenceSpell.Name + "."); } else { caster.WriteToDisplay("You cast " + ReferenceSpell.Name + " at " + target.GetNameForActionResult(true).Replace("The ", "the ")); } return(true); }
/// <summary> /// This method is always performed first when acquiring a target with arguments. /// </summary> /// <param name="targeter">The Character object doing the targetting.</param> /// <param name="args">The full arguments for target acquisition.</param> /// <returns>Character object target or null.</returns> public static Character AcquireTarget(Character targeter, string args, int maxDistance, int minDistance) { string[] sArgs = args.Split(" ".ToCharArray()); int countTo = 0; Character target = null; // acquiring target in targeter's current cell if (maxDistance == 0 && minDistance == 0) { if (Int32.TryParse(sArgs[0], out countTo)) { if (sArgs.Length >= 2) { target = TargetAquisition.FindTargetInCell(targeter, sArgs[1], countTo); } else { target = TargetAquisition.FindTargetInCell(targeter, sArgs[0]); } } else { target = TargetAquisition.FindTargetInCell(targeter, sArgs[0]); } } if (target == null) { if (sArgs.Length >= 2 && Int32.TryParse(sArgs[0], out countTo)) { target = TargetAquisition.FindTargetInView(targeter, sArgs[1], countTo); } else { target = TargetAquisition.FindTargetInView(targeter, sArgs[0], false, true); } } if (target == null || Cell.GetCellDistance(targeter.X, targeter.Y, target.X, target.Y) > maxDistance) { return(null); } return(target); }
public static void Recall(Character chr, Item item, int hand) { chr.SendShout("a thunderclap!"); chr.WriteToDisplay("You hear a thunderclap!"); chr.EmitSound(Sound.GetCommonSound(Sound.CommonSound.ThunderClap)); chr.CurrentCell = Cell.GetCell(chr.FacetID, item.recallLand, item.recallMap, item.recallX, item.recallY, item.recallZ); chr.SendShout("a thunderclap!"); chr.SendSoundToAllInRange(Sound.GetCommonSound(Sound.CommonSound.ThunderClap)); item = Item.CopyItemFromDictionary(Item.ID_GOLDRING); if (hand == (int)Globals.eWearOrientation.Left) { chr.EquipLeftHand(item); } else if (hand == (int)Globals.eWearOrientation.Right) { chr.EquipRightHand(item); } // if hand == 0 or Globals.eWearOrientation.None, or any other integer, the item disappears }
public static Character AcquireTarget(Character targeter, string[] sArgs, int maxDistance, int minDistance) { int countTo = 0; Character target = null; // acquiring target in targeter's current cell if (maxDistance == 0) { if (Int32.TryParse(sArgs[0], out countTo)) { if (sArgs.Length >= 2) // # target { target = FindTargetInCell(targeter, sArgs[1], countTo); } else { target = FindTargetInCell(targeter, sArgs[0]); // target is unique ID } } else { target = FindTargetInCell(targeter, sArgs[0]); } } if (sArgs.Length >= 2 && Int32.TryParse(sArgs[0], out countTo)) // <command> # <target> { target = FindTargetInView(targeter, sArgs[1], countTo); } else { target = FindTargetInView(targeter, sArgs[0], false, true); } if (target == null || Cell.GetCellDistance(targeter.X, targeter.Y, target.X, target.Y) > maxDistance) { return(null); } return(target); }
public static bool SuccessfulPathTest(string name, Cell originCell, Cell targetCell) { if (originCell == null || targetCell == null) { return(false); } if (originCell == targetCell) { return(true); } PathTest pathTestDummy = new PathTest(name, originCell); pathTestDummy.AddToWorld(); bool returnVal = pathTestDummy.BuildMoveList(targetCell.X, targetCell.Y, targetCell.Z); pathTestDummy.RemoveFromWorld(); return(returnVal); }
public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, true); int bitcount = 0; //loop through all visible cells for (int ypos = -3; ypos <= 3; ypos += 1) { for (int xpos = -3; xpos <= 3; xpos += 1) { Cell cell = Cell.GetCell(caster.FacetID, caster.LandID, caster.MapID, caster.X + xpos, caster.Y + ypos, caster.Z); if (caster.CurrentCell.visCells[bitcount] && cell.IsSecretDoor) { if (cell.AreaEffects.ContainsKey(Effect.EffectTypes.Hide_Door)) { cell.AreaEffects[Effect.EffectTypes.Hide_Door].StopAreaEffect(); } else { Effect.EffectTypes effectType = Effect.EffectTypes.Find_Secret_Door; string soundFile = Sound.GetCommonSound(Sound.CommonSound.OpenDoor); if (cell.DisplayGraphic == Cell.GRAPHIC_MOUNTAIN || cell.CellGraphic == Cell.GRAPHIC_MOUNTAIN) { effectType = Effect.EffectTypes.Find_Secret_Rockwall; soundFile = Sound.GetCommonSound(Sound.CommonSound.SlidingRockDoor); } AreaEffect effect = new AreaEffect(effectType, Cell.GRAPHIC_EMPTY, 0, (Skills.GetSkillLevel(caster.magic) / 2) + 10, caster, cell); cell.EmitSound(soundFile); } } bitcount++; } } return(true); }
public static void SetupNewCharacter(PC ch) { DAL.DBWorld.SetupNewCharacter(ch); #region Set High Skills ch.highMace = ch.mace; // high skills ch.highBow = ch.bow; ch.highFlail = ch.flail; ch.highDagger = ch.dagger; ch.highRapier = ch.rapier; ch.highTwoHanded = ch.twoHanded; ch.highStaff = ch.staff; ch.highShuriken = ch.shuriken; ch.highSword = ch.sword; ch.highThreestaff = ch.threestaff; ch.highHalberd = ch.halberd; ch.highUnarmed = ch.unarmed; ch.highThievery = ch.thievery; ch.highMagic = ch.magic; #endregion #region 1 Gold Coin, or Sorcerers get a random amount between 250 - 300 Item coin = Item.CopyItemFromDictionary(Item.ID_COINS); // most new characters get a single shiny coin coin.coinValue = 1; // sorcerer starts with more gold if (ch.BaseProfession == Character.ClassType.Sorcerer) { coin.coinValue = Rules.Dice.Next(250, 300); } ch.SackItem(coin); #endregion #region Set Starting Location switch (ch.BaseProfession) // starting location in the game { case Character.ClassType.Thief: ch.LandID = 0; ch.MapID = 0; ch.X = 51; ch.Y = 26; ch.Z = 0; ch.CurrentCell = Cell.GetCell(0, 0, 0, 51, 26, 0); break; case Character.ClassType.Sorcerer: ch.LandID = 0; ch.MapID = 0; ch.X = 139; ch.Y = 46; ch.Z = 0; ch.CurrentCell = Cell.GetCell(0, 0, 0, 139, 46, 0); break; default: // Kesmai dock ch.LandID = 0; ch.MapID = 0; ch.X = 41; ch.Y = 33; ch.Z = 0; ch.CurrentCell = Cell.GetCell(0, 0, 0, 41, 33, 0); break; } #endregion ch.Experience = 1600; // set character experience and level ch.Level = 3; ch.Hits = ch.HitsMax; // set stats to max ch.Stamina = ch.StaminaMax; ch.Mana = ch.ManaMax; ch.dirPointer = "^"; ch.Save(); // save // player ID was created upon save ch.UniqueID = PC.GetPlayerID(ch.Name); #region New Spellbook if (Array.IndexOf(GameWorld.World.SpellWarmingProfessions, ch.BaseProfession) > -1) { ch.SackItem(Item.CopyItemFromDictionary(Item.ID_SPELLBOOK)); } #endregion // create a new mailbox for the new player, as their player ID was assigned suring the call to Save() ch.Mailbox = new Mail.GameMail.GameMailbox(ch.UniqueID); //ch = (Character)newpc; // cast the newpc back into a Character Menu.PrintMainMenu(ch as PC); // back to the menu ch.PCState = Globals.ePlayerState.MAINMENU; }
public PathTest(string name, Cell currentCell) : base() { this.Name = name; this.CurrentCell = currentCell; this.IsInvisible = true; // added 11/27/2015 Eb }
public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, false); int xpos = 0; int ypos = 0; args = args.Replace(ReferenceSpell.Command, ""); args = args.Trim(); string[] sArgs = args.Split(" ".ToCharArray()); #region Get the direction switch (sArgs[0]) { case "south": case "s": ypos++; break; case "southeast": case "se": ypos++; xpos++; break; case "southwest": case "sw": ypos++; xpos--; break; case "west": case "w": xpos--; break; case "east": case "e": xpos++; break; case "northeast": case "ne": ypos--; xpos++; break; case "northwest": case "nw": ypos--; xpos--; break; case "north": case "n": ypos--; break; default: break; } #endregion Cell cell = Cell.GetCell(caster.FacetID, caster.LandID, caster.MapID, caster.X + xpos, caster.Y + ypos, caster.Z); foreach (AreaEffect effect in new List <AreaEffect>(cell.AreaEffects.Values)) { if (effect.EffectType == Effect.EffectTypes.Illusion) { effect.StopAreaEffect(); } } return(true); }
/// <summary> /// Find a target in view using player ID or unique world NPC ID aassigned upon NPC spawning. /// </summary> /// <param name="ch">The character that is attempting to find the target.</param> /// <param name="id">Either the player ID or the NPC's world ID.</param> /// <param name="includeSelf">True if should include self in search.</param> /// <param name="includeHidden">True if should include hidden targets.</param> /// <returns>The found Character object or null.</returns> public static Character FindTargetInView(Character ch, int id, bool includeSelf, bool includeHidden) { if (ch.UniqueID == id) { return(ch); } if (ch.CurrentCell != null && !includeSelf && (ch.CurrentCell.AreaEffects.ContainsKey(Effect.EffectTypes.Darkness) || ch.CurrentCell.IsAlwaysDark) && !ch.HasNightVision) { return(null); } if (ch.IsBlind) { return(null); } Cell cell = null; int bitcount = 0; int ypos = -15; int xpos = -15; try { //loop through all visible cells for (ypos = -3; ypos <= 3; ypos += 1) { for (xpos = -3; xpos <= 3; xpos += 1) { if (ch.CurrentCell != null) { if (ch.CurrentCell.visCells != null) { if (ch.CurrentCell.visCells.Count >= bitcount + 1) { if (ch.CurrentCell.visCells[bitcount]) { if (ch.CurrentCell.Characters != null && ch.CurrentCell.Characters.Values.Count > 0) { try { cell = Cell.GetCell(ch.FacetID, ch.LandID, ch.MapID, ch.X + xpos, ch.Y + ypos, ch.Z); // look for the character in the charlist of the cell foreach (Character chr in cell.Characters.Values) { // If the found character is the target seeker and not including self, iterate. if (chr == ch && !includeSelf) { continue; } // PCs looking for a player ID if (chr.IsPC && chr.UniqueID == id) { if (Rules.DetectHidden(chr, ch) && Rules.DetectInvisible(chr, ch)) { return(chr); } } // NPCs looking for an NPC world ID. else if ((!ch.IsPC && chr.UniqueID == id) && (ch.Alignment == chr.Alignment)) { // NPCs of the same alignment always know where the other NPC is... if (ch.Alignment == chr.Alignment) { return(chr); } // NPCs of differing alignments need to use hiding and invis rules else if (Rules.DetectHidden(chr, ch) && Rules.DetectInvisible(chr, ch)) { return(chr); } } } } catch (Exception e) { Utils.LogException(e); } } } } } } bitcount++; } } return(null); } catch (Exception e) { Utils.LogException(e); //Utils.Log("Failure at Map.FindTargetInView. Character: " + ch.GetLogString() + " TargetID: " + id + " xpos = " + xpos + " ypos = " + ypos, Utils.LogType.Unknown); return(null); } }
/// <summary> /// /// </summary> /// <param name="ch"></param> /// <param name="targetName"></param> /// <returns></returns> public static Character FindTargetInCell(Character ch, string targetName) { // TODO: add blind fighting if (ch.CurrentCell != null && (ch.CurrentCell.AreaEffects.ContainsKey(Effect.EffectTypes.Darkness) || ch.CurrentCell.IsAlwaysDark) && !ch.HasNightVision) { return(null); } if (ch.IsBlind && !ch.HasTalent(Talents.GameTalent.TALENTS.BlindFighting)) { return(null); } int SubStrLen = 0; Cell cell = Cell.GetCell(ch.FacetID, ch.LandID, ch.MapID, ch.X, ch.Y, ch.Z); Int32.TryParse(targetName, out int id); // look for the target in the seenlist first. if (ch.seenList.Count > 0) { foreach (Character chr in new List <Character>(ch.seenList)) { if (id == chr.UniqueID) { return(chr); } else { if (chr.Name.Length < targetName.Length) { continue; } SubStrLen = targetName.Length; if (chr.Name.ToLower().Substring(0, SubStrLen) == targetName.ToLower() && chr != ch && chr.CurrentCell == cell) { return(chr); } } } } // look for the character in the charlist of the cell if (cell.Characters.Count > 0) { foreach (Character chr in cell.Characters.Values) { if (id == chr.UniqueID) { return(chr); } else { if (chr.Name.Length < targetName.Length) { continue; } SubStrLen = targetName.Length; // compare the substring against the targetName and see if we find a match if (chr.Name.ToLower().Substring(0, SubStrLen) == targetName.ToLower() && chr != ch && !chr.IsInvisible) { return(chr); } } } } return(null); }
/// <summary> /// Find a target in view by using a target name. /// </summary> /// <param name="ch">The Character searching for a target.</param> /// <param name="targetNameOrID">The name or unique ID of the target to search for.</param> /// <param name="includeSelf">True to include Character doing the searching.</param> /// <param name="includeHidden">True to include all hidden objects in view.</param> /// <returns>The found Character object or null.</returns> public static Character FindTargetInView(Character ch, string targetNameOrID, bool includeSelf, bool includeHidden) { if (!ch.IsImmortal && ch.CurrentCell != null && ((ch.CurrentCell.AreaEffects.ContainsKey(Effect.EffectTypes.Darkness) || ch.CurrentCell.IsAlwaysDark) && !ch.HasNightVision) || ch.IsBlind) { if (!ch.HasTalent(Talents.GameTalent.TALENTS.BlindFighting)) { return(null); } else { // commands allowed if Character has BlindFighting if (!ch.CommandsProcessed.Contains(CommandTasker.CommandType.Attack) && !ch.CommandsProcessed.Contains(CommandTasker.CommandType.Shield_Bash) && !ch.CommandsProcessed.Contains(CommandTasker.CommandType.Kick)) { return(null); } } } int SubStrLen = 0; int bitcount = 0; if (ch == null) { return(null); } Cell cell = null; Int32.TryParse(targetNameOrID, out int id); if (ch.seenList.Count > 0) { foreach (Character chr in new List <Character>(ch.seenList)) { if (id != 0 && chr.UniqueID == id) { return(chr); } else { if (chr.Name.Length < targetNameOrID.Length) { continue; } SubStrLen = targetNameOrID.Length; if (chr.Name.ToLower().Substring(0, SubStrLen) == targetNameOrID.ToLower() && chr != ch) { return(chr); } } } } try { // loop through all visible cells // TODO: if visibility restrictions are once again put into place these numbers will be changed for (int ypos = -3; ypos <= 3; ypos += 1) { for (int xpos = -3; xpos <= 3; xpos += 1) { if (ch.CurrentCell.visCells[bitcount]) { cell = Cell.GetCell(ch.FacetID, ch.LandID, ch.MapID, ch.X + xpos, ch.Y + ypos, ch.Z); if (cell == null) { continue; } // look for the character in the charlist of the cell foreach (Character chr in cell.Characters.Values) { if (id != 0 && chr.UniqueID == id) { return(chr); } else { if (chr.Name.Length < targetNameOrID.Length) { continue; } SubStrLen = targetNameOrID.Length; if ((includeHidden && Rules.DetectHidden(chr, ch)) || (!chr.IsHidden && Rules.DetectInvisible(chr, ch))) { if (includeSelf) { if (chr.Name.ToLower().Substring(0, SubStrLen) == targetNameOrID.ToLower()) { return(chr); } } else { if (chr.Name.ToLower().Substring(0, SubStrLen) == targetNameOrID.ToLower() && chr != ch) { return(chr); } } } } }//end foreach } bitcount++; } } return(null); } catch (Exception e) { Utils.LogException(e); return(null); } }
/// <summary> /// Finds a target in view. Checks current cell first, then starts in top left, across to right, down (back to left) to right etc. /// </summary> /// <param name="ch">The character attempting to find a target.</param> /// <param name="lookTarget">The target name.</param> /// <param name="countTo">The number of targets with the same name to skip through.</param> /// <returns>The found Character object or null.</returns> public static Character FindTargetInView(Character ch, string lookTarget, int countTo) { try { if (ch == null) { return(null); } if (ch.CurrentCell != null && ((ch.CurrentCell.AreaEffects.ContainsKey(Effect.EffectTypes.Darkness) || ch.CurrentCell.IsAlwaysDark) && !ch.HasNightVision) || ch.IsBlind) { if (!ch.HasTalent(Talents.GameTalent.TALENTS.BlindFighting)) { return(null); } else { // commands allowed if Character has BlindFighting if (!ch.CommandsProcessed.Contains(CommandTasker.CommandType.Attack) && !ch.CommandsProcessed.Contains(CommandTasker.CommandType.Shield_Bash) && !ch.CommandsProcessed.Contains(CommandTasker.CommandType.Kick)) { return(null); } } } int subLen = lookTarget.Length; int itemcount = 1; if (countTo <= 0) { countTo = 1; } if (subLen <= 0) { return(null); // someone entered a command of "fight (or attack) 'something'" where 'something' is a space or other character not decipherable. } foreach (Character target in ch.CurrentCell.Characters.Values) { if (target != ch && Rules.DetectHidden(target, ch) && Rules.DetectInvisible(target, ch) && target.Name.ToLower().StartsWith(lookTarget.ToLower())) { if (countTo == itemcount) { return(target); } itemcount++; } } var cellArray = Cell.GetApplicableCellArray(ch.CurrentCell, ch.GetVisibilityDistance()); var fullCellArray = Cell.GetApplicableCellArray(ch.CurrentCell, Cell.DEFAULT_VISIBLE_DISTANCE); for (int j = 0; j < cellArray.Length; j++) { if (cellArray[j] == null && ch.CurrentCell.visCells[j] && fullCellArray.Length >= j + 1 && fullCellArray[j] != null) { Globals.eLightSource lightsource; // no use for this yet if (fullCellArray[j].HasLightSource(out lightsource) && !AreaEffect.CellContainsLightAbsorbingEffect(fullCellArray[j])) { cellArray[j] = fullCellArray[j]; } } if (cellArray[j] == null || ch.CurrentCell.visCells[j] == false) { // do nothing } else { // create array of targets if (cellArray[j] != ch.CurrentCell && cellArray[j].Characters.Count > 0) { foreach (Character target in cellArray[j].Characters.Values) { if (target != ch && Rules.DetectHidden(target, ch) && Rules.DetectInvisible(target, ch) && target.Name.ToLower().StartsWith(lookTarget.ToLower())) { if (countTo == itemcount) { return(target); } itemcount++; } } } } } return(null); } catch (Exception e) { Utils.LogException(e); return(null); } }
//roll up stats public static string RollStats(Character ch) { string rtnStr = ""; string manaStr = "\r\n"; ch.CurrentCell = Cell.GetCell(0, 0, 0, 41, 34, 0); if (ch.Level != 3) { ch.Level = 3; } // set level to 3 ch.Strength = AdjustMinMaxStat(RollStat() + GetRacialBonus(ch, Globals.eAbilityStat.Strength)); ch.Dexterity = AdjustMinMaxStat(RollStat() + GetRacialBonus(ch, Globals.eAbilityStat.Dexterity)); ch.Intelligence = AdjustMinMaxStat(RollStat() + GetRacialBonus(ch, Globals.eAbilityStat.Intelligence)); ch.Wisdom = AdjustMinMaxStat(RollStat() + GetRacialBonus(ch, Globals.eAbilityStat.Wisdom)); ch.Constitution = AdjustMinMaxStat(RollStat() + GetRacialBonus(ch, Globals.eAbilityStat.Constitution)); ch.Charisma = AdjustMinMaxStat(RollStat() + GetRacialBonus(ch, Globals.eAbilityStat.Charisma)); if (ch.Strength >= 16) { ch.strengthAdd = 1; } else { ch.strengthAdd = 0; } if (ch.Dexterity >= 16) { ch.dexterityAdd = 1; } else { ch.dexterityAdd = 0; } ch.HitsMax = Rules.GetHitsGain(ch, ch.Level) + (int)(ch.Land.StatCapOperand / 1.5); ch.StaminaMax = Rules.GetStaminaGain(ch, 1) + (int)(ch.Land.StatCapOperand / 8); ch.ManaMax = 0; if (ch.IsSpellUser) { ch.ManaMax = Rules.GetManaGain(ch, 1) + (int)(ch.Land.StatCapOperand / 8); manaStr = "Mana: " + ch.ManaMax.ToString().PadLeft(2) + "\r\n"; } if (ch.HitsMax > Rules.GetMaximumHits(ch)) { ch.HitsMax = Rules.GetMaximumHits(ch); } //if (ch.protocol == DragonsSpineMain.Instance.Settings.DefaultProtocol) //{ // return ProtocolYuusha.CHARGEN_ROLLER_RESULTS + ProtocolYuusha.FormatCharGenRollerResults(ch) + ProtocolYuusha.CHARGEN_ROLLER_RESULTS_END; //} rtnStr = rtnStr + "\r\nCharacter Stats:\r\n"; rtnStr = rtnStr + " Strength: " + ch.Strength.ToString().PadLeft(2).PadRight(10) + "Adds: " + ch.strengthAdd + "\r\n"; rtnStr = rtnStr + " Dexterity: " + ch.Dexterity.ToString().PadLeft(2).PadRight(10) + "Adds: " + ch.dexterityAdd + "\r\n"; rtnStr = rtnStr + " Intelligence: " + ch.Intelligence.ToString().PadLeft(2) + "\r\n"; rtnStr = rtnStr + " Wisdom: " + ch.Wisdom.ToString().PadLeft(2).PadRight(10) + "Hits: " + ch.HitsMax.ToString().PadLeft(2) + "\r\n"; rtnStr = rtnStr + " Constitution: " + ch.Constitution.ToString().PadLeft(2).PadRight(10) + "Stamina: " + ch.StaminaMax.ToString().PadLeft(2) + "\r\n"; rtnStr = rtnStr + " Charisma: " + ch.Charisma.ToString().PadLeft(2).PadRight(10) + manaStr; rtnStr = rtnStr + "\r\nRoll Again? (y,n): "; return(rtnStr); }
public bool OnCast(Character caster, string args) { int xpos = 0; int ypos = 0; //clean out the command name args = args.Replace(ReferenceSpell.Command, ""); args = args.Trim(); string[] sArgs = args.Split(" ".ToCharArray()); switch (sArgs[0]) { case "south": case "s": ypos++; break; case "southeast": case "se": ypos++; xpos++; break; case "southwest": case "sw": ypos++; xpos--; break; case "west": case "w": xpos--; break; case "east": case "e": xpos++; break; case "northeast": case "ne": ypos--; xpos++; break; case "northwest": case "nw": ypos--; xpos--; break; case "north": case "n": ypos--; break; default: break; } Cell cell = Cell.GetCell(caster.FacetID, caster.LandID, caster.MapID, caster.X + xpos, caster.Y + ypos, caster.Z); ArrayList cells = new ArrayList(); cells.Add(cell); if ((cell.DisplayGraphic == Cell.GRAPHIC_WALL && !cell.IsMagicDead) || caster.IsImmortal) { ReferenceSpell.SendGenericCastMessage(caster, null, true); AreaEffect effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_EMPTY, 1, 2, caster, cells); } else { //GenericFailMessage(caster, ""); return(false); } return(true); }
//TODO: expand on this by using place names public bool OnCommand(Character chr, string args) { // Scribing crystal. if (args.ToLower() == "sc" || args.ToLower() == "scribe" || args.ToLower() == "crystal") { foreach (GameWorld.Land land in chr.Facet.Lands) { foreach (GameWorld.Map map in land.Maps) { foreach (GameWorld.Cell cell in map.cells.Values) { if (cell.HasScribingCrystal) { chr.CurrentCell = cell; chr.WriteToDisplay("You have teleported to a scribing crystal in " + map.Name + "."); return(true); } } } } if (!chr.CurrentCell.HasScribingCrystal) { chr.WriteToDisplay("Failed to find a scribing crystal. This shouldn't occur."); return(true); } } try { string[] sArgs = args.Split(" ".ToCharArray()); short facet, land, map; int x, y, z; facet = Convert.ToInt16(sArgs[0]); land = Convert.ToInt16(sArgs[1]); map = Convert.ToInt16(sArgs[2]); x = Convert.ToInt32(sArgs[3]); y = Convert.ToInt32(sArgs[4]); z = Convert.ToInt32(sArgs[5]); Cell gotoCell = Cell.GetCell(facet, land, map, x, y, z); if (gotoCell == null || gotoCell.IsOutOfBounds) { chr.WriteToDisplay("That place is outside of the map bounds."); } else { if (!chr.IsInvisible) { chr.SendToAllInSight(chr.Name + " disappears in a poof of smoke!"); } chr.CurrentCell = gotoCell; if (!chr.IsInvisible) { chr.SendToAllInSight(chr.Name + " appears with a poof of smoke."); } } return(true); } catch { chr.WriteToDisplay("Format: impgotoloc <facet> <land> <map> <x> <y> <z>"); return(false); } }
public bool OnCast(Character caster, string args) { args = args.Replace(ReferenceSpell.Command, ""); args = args.Trim(); Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); Cell dCell = null; if (target == null) { dCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, false); } else { dCell = target.CurrentCell; } if (dCell == null && target == null) { return(false); } //var tCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, true); if (dCell != null) { // destroy all but attuned items foreach (var item in new List <Item>(dCell.Items)) { if (item.attunedID <= 0 && !item.IsArtifact() && !((item is Corpse) && (item as Corpse).IsPlayerCorpse)) { dCell.Remove(item); } } // do spell damage foreach (Character chr in dCell.Characters.Values) { if (Combat.DoSpellDamage(caster, chr, null, Skills.GetSkillLevel(caster.magic) * 10, ReferenceSpell.Name.ToLower()) == 1) { Rules.GiveAEKillExp(caster, chr); } } // destroy walls for a while if (!dCell.IsMagicDead) { if (dCell.DisplayGraphic == Cell.GRAPHIC_WALL) { var newDispGraphic = Rules.RollD(1, 20) >= 10 ? Cell.GRAPHIC_RUINS_LEFT : Cell.GRAPHIC_RUINS_RIGHT; var effect = new AreaEffect(Effect.EffectTypes.Illusion, newDispGraphic, 0, (int)Skills.GetSkillLevel(caster.magic) * 6, caster, dCell); dCell.SendShout("a wall crumbling."); } else if (dCell.DisplayGraphic == Cell.GRAPHIC_RUINS_LEFT || dCell.DisplayGraphic == Cell.GRAPHIC_RUINS_RIGHT) { var newDispGraphic = Rules.RollD(1, 20) >= 10 ? Cell.GRAPHIC_BARREN_LEFT : Cell.GRAPHIC_BARREN_RIGHT; var effect = new AreaEffect(Effect.EffectTypes.Illusion, newDispGraphic, 0, (int)Skills.GetSkillLevel(caster.magic) * 6, caster, dCell); dCell.SendShout("stone crumbling to dust."); } } } ReferenceSpell.SendGenericCastMessage(caster, null, true); return(true); }
public bool OnCommand(Character chr, string args) { if (args == null) { chr.WriteToDisplay("Facet number no longer required, as this is currently always 0."); chr.WriteToDisplay("Format: psitel <land> <map> <ycord> <xcord> <zcord>"); return true; } else { try { string[] sArgs = args.Split(" ".ToCharArray()); int facet, land, map; int x, y, z; facet = chr.FacetID; land = Convert.ToInt16(sArgs[0]); map = Convert.ToInt16(sArgs[1]); x = Convert.ToInt32(sArgs[2]); y = Convert.ToInt32(sArgs[3]); z = Convert.ToInt32(sArgs[4]); if (sArgs.Length >= 6) { chr.WriteToDisplay("Facet number no longer required, as this is currently always 0."); chr.WriteToDisplay("Format: psitel <land> <map> <ycord> <xcord> <zcord>"); return true; } Cell pCell = Cell.GetCell(facet, land, map, x, y, z); if (pCell == null || pCell.IsOutOfBounds) { chr.WriteToDisplay("That place is outside of the map bounds."); return true; } else { if ((chr as PC).ImpLevel < Globals.eImpLevel.GM) { if (pCell.IsLair || pCell.IsNoRecall) { chr.WriteToDisplay("You do not have sufficient privilege level to teleport directly into a lair or no recall zone."); return true; } if (chr.CurrentCell != null && (chr.CurrentCell.IsLair || chr.CurrentCell.IsNoRecall)) { chr.WriteToDisplay("You do not have sufficient privilege level to teleport out of a lair or no recall zone."); return true; } if (chr.WhichHand("corpse") > (int)Globals.eWearOrientation.None) { chr.WriteToDisplay("You do not have sufficient privilege level to teleport while carrying a corpse."); return true; } } if (!chr.IsInvisible) chr.SendToAllInSight(chr.GetNameForActionResult() + " disappears in a poof of smoke and amazing huzzah!"); chr.CurrentCell = Cell.GetCell(facet, land, map, x, y, z); if (!chr.IsInvisible) { chr.SendShout("sizzling followed by a thunderclap!"); chr.SendToAllInSight(chr.GetNameForActionResult() + " appears with a puff of smoke and huzzah."); chr.WriteToDisplay("You hear sizzling followed by a thunderclap!"); } } } catch { chr.WriteToDisplay("Facet number no longer required, as this is currently always 0."); chr.WriteToDisplay("Format: psitel <land> <map> <ycord> <xcord> <zcord>"); } } return true; }