本文整理匯總了C#中Server.MirDatabase.UserMagic.GetInfo方法的典型用法代碼示例。如果您正苦於以下問題:C# UserMagic.GetInfo方法的具體用法?C# UserMagic.GetInfo怎麽用?C# UserMagic.GetInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.MirDatabase.UserMagic
的用法示例。
在下文中一共展示了UserMagic.GetInfo方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddTempSkills
private void AddTempSkills(IEnumerable<string> skillsToAdd)
{
foreach (var skill in skillsToAdd)
{
Spell spelltype;
bool hasSkill = false;
if (!Enum.TryParse(skill, out spelltype)) return;
for (var i = Info.Magics.Count - 1; i >= 0; i--)
if (Info.Magics[i].Spell == spelltype) hasSkill = true;
if (hasSkill) continue;
var magic = new UserMagic(spelltype) { IsTempSpell = true };
Info.Magics.Add(magic);
Enqueue(magic.GetInfo());
}
}
示例2: Chat
//.........這裏部分代碼省略.........
if (parts.Length > 3)
{
if (!IsGM) return;
player = Envir.GetPlayer(parts[1]);
if (player == null)
{
ReceiveChat(string.Format("Player {0} was not found.", parts[1]), ChatType.System);
return;
}
}
var magic = new UserMagic(skill) { Level = spellLevel };
if (player.Info.Magics.Any(e => e.Spell == skill))
{
player.Info.Magics.FirstOrDefault(e => e.Spell == skill).Level = spellLevel;
player.ReceiveChat(string.Format("Spell {0} changed to level {1}", skill.ToString(), spellLevel), ChatType.Hint);
return;
}
else
{
player.ReceiveChat(string.Format("You have learned {0} at level {1}", skill.ToString(), spellLevel), ChatType.Hint);
if (player != this)
{
ReceiveChat(string.Format("{0} has learned {1} at level {2}", player.Name, skill.ToString(), spellLevel), ChatType.Hint);
}
player.Info.Magics.Add(magic);
}
player.Enqueue(magic.GetInfo());
player.RefreshStats();
break;
case "FIND":
if (!IsGM && !HasProbeNecklace) return;
if (Envir.Time < LastProbeTime)
{
ReceiveChat(string.Format("You cannot search for another {0} seconds", (LastProbeTime - Envir.Time) / 1000), ChatType.System);
return;
}
if (parts.Length < 2) return;
player = Envir.GetPlayer(parts[1]);
if (player == null)
{
ReceiveChat(parts[1] + " is not online", ChatType.System);
return;
}
if (player.CurrentMap == null) return;
if (!IsGM)
LastProbeTime = Envir.Time + 180000;
ReceiveChat((string.Format("{0} is located at {1} ({2},{3})", player.Name, player.CurrentMap.Info.Title, player.CurrentLocation.X, player.CurrentLocation.Y)), ChatType.System);
break;
case "LEAVEGUILD":
if (MyGuild == null) return;
if (MyGuildRank == null) return;
MyGuild.DeleteMember(this, Name);
break;
示例3: UseItem
//.........這裏部分代碼省略.........
ReceiveChat(String.Format("{0} Credits have been added to your Account", item.Info.Price), ChatType.Hint);
}
break;
case 8: //MapShoutScroll
HasMapShout = true;
ReceiveChat("You have been given one free shout across your current map", ChatType.Hint);
break;
case 9://ServerShoutScroll
HasServerShout = true;
ReceiveChat("You have been given one free shout across the server", ChatType.Hint);
break;
case 10://GuildSkillScroll
MyGuild.NewBuff(item.Info.Effect, false);
break;
case 11://HomeTeleport
if (MyGuild != null && MyGuild.Conquest != null && !MyGuild.Conquest.WarIsOn && MyGuild.Conquest.PalaceMap != null && !TeleportRandom(200, 0, MyGuild.Conquest.PalaceMap))
{
Enqueue(p);
return;
}
break;
}
break;
case ItemType.Book:
UserMagic magic = new UserMagic((Spell)item.Info.Shape);
if (magic.Info == null)
{
Enqueue(p);
return;
}
Info.Magics.Add(magic);
Enqueue(magic.GetInfo());
RefreshStats();
break;
case ItemType.Script:
CallDefaultNPC(DefaultNPCType.UseItem, item.Info.Shape);
break;
case ItemType.Food:
temp = Info.Equipment[(int)EquipmentSlot.Mount];
if (temp == null || temp.MaxDura == temp.CurrentDura)
{
Enqueue(p);
return;
}
switch (item.Info.Shape)
{
case 0:
temp.MaxDura = (ushort)Math.Max(0, temp.MaxDura - Math.Min(1000, temp.MaxDura - (temp.CurrentDura / 30)));
break;
case 1:
break;
}
temp.CurrentDura = (ushort)Math.Min(temp.MaxDura, temp.CurrentDura + item.CurrentDura);
temp.DuraChanged = false;
ReceiveChat("Your mount has been fed.", ChatType.Hint);
Enqueue(new S.ItemRepaired { UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura });
RefreshStats();
break;
case ItemType.Pets:
if (item.Info.Shape >= 20)
示例4: UseItem
//.........這裏部分代碼省略.........
ReceiveChat("You can now unequip a cursed item.", ChatType.Hint);
UnlockCurse = true;
break;
}
break;
case ItemType.Scroll:
UserItem temp;
switch (item.Info.Shape)
{
case 0: //DE
if (!TeleportEscape(20))
{
Enqueue(p);
return;
}
break;
case 1: //TT
if (!Teleport(Envir.GetMap(BindMapIndex), BindLocation))
{
Enqueue(p);
return;
}
break;
case 2: //RT
if (!TeleportRandom(200, item.Info.Durability))
{
Enqueue(p);
return;
}
break;
case 3:
if (!TryLuckWeapon())
{
Enqueue(p);
return;
}
break;
case 4:
temp = Info.Equipment[(int)EquipmentSlot.Weapon];
if (temp == null || temp.MaxDura == temp.CurrentDura)
{
Enqueue(p);
return;
}
if (temp.Info.Bind.HasFlag(BindMode.DontRepair))
{
Enqueue(p);
return;
}
temp.MaxDura = (ushort)Math.Max(0, temp.MaxDura - Math.Min(5000, temp.MaxDura - temp.CurrentDura) / 8);
temp.CurrentDura = (ushort)Math.Min(temp.MaxDura, temp.CurrentDura + 5000);
temp.DuraChanged = false;
ReceiveChat("Your weapon has been partially repaired", ChatType.Hint);
Enqueue(new S.ItemRepaired {UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura});
break;
case 5:
temp = Info.Equipment[(int)EquipmentSlot.Weapon];
if (temp == null || temp.MaxDura == temp.CurrentDura)
{
Enqueue(p);
return;
}
if (temp.Info.Bind.HasFlag(BindMode.DontRepair) || temp.Info.BindNoSRepair)
{
Enqueue(p);
return;
}
temp.CurrentDura = temp.MaxDura;
temp.DuraChanged = false;
ReceiveChat("Your weapon has been completely repaired", ChatType.Hint);
Enqueue(new S.ItemRepaired { UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura });
break;
}
break;
case ItemType.Book:
UserMagic magic = new UserMagic((Spell)item.Info.Shape);
if (magic.Info == null)
{
Enqueue(p);
return;
}
Info.Magics.Add(magic);
Enqueue(magic.GetInfo());
break;
default:
return;
}
if (item.Count > 1) item.Count--;
else Info.Inventory[index] = null;
RefreshBagWeight();
p.Success = true;
Enqueue(p);
}
示例5: UseItem
//.........這裏部分代碼省略.........
return;
}
break;
case 3: //BenedictionOil
if (!TryLuckWeapon())
{
Enqueue(p);
return;
}
break;
case 4: //RepairOil
temp = Info.Equipment[(int)EquipmentSlot.Weapon];
if (temp == null || temp.MaxDura == temp.CurrentDura)
{
Enqueue(p);
return;
}
if (temp.Info.Bind.HasFlag(BindMode.DontRepair))
{
Enqueue(p);
return;
}
temp.MaxDura = (ushort)Math.Max(0, temp.MaxDura - Math.Min(5000, temp.MaxDura - temp.CurrentDura) / 30);
temp.CurrentDura = (ushort)Math.Min(temp.MaxDura, temp.CurrentDura + 5000);
temp.DuraChanged = false;
ReceiveChat("Your weapon has been partially repaired", ChatType.Hint);
Enqueue(new S.ItemRepaired { UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura });
break;
case 5: //WarGodOil
temp = Info.Equipment[(int)EquipmentSlot.Weapon];
if (temp == null || temp.MaxDura == temp.CurrentDura)
{
Enqueue(p);
return;
}
if (temp.Info.Bind.HasFlag(BindMode.DontRepair) || temp.Info.BindNoSRepair)
{
Enqueue(p);
return;
}
temp.CurrentDura = temp.MaxDura;
temp.DuraChanged = false;
ReceiveChat("Your weapon has been completely repaired", ChatType.Hint);
Enqueue(new S.ItemRepaired { UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura });
break;
}
break;
case ItemType.Book:
UserMagic magic = new UserMagic((Spell)item.Info.Shape);
if (magic.Info == null)
{
Enqueue(p);
return;
}
Info.Magics.Add(magic);
Enqueue(magic.GetInfo());
RefreshStats();
break;
case ItemType.Script:
CallDefaultNPC(DefaultNPCType.UseItem, item.Info.Shape);
break;
case ItemType.Food:
temp = Info.Equipment[(int)EquipmentSlot.Mount];
if (temp == null || temp.MaxDura == temp.CurrentDura)
{
Enqueue(p);
return;
}
switch (item.Info.Shape)
{
case 0:
temp.MaxDura = (ushort)Math.Max(0, temp.MaxDura - Math.Min(1000, temp.MaxDura - (temp.CurrentDura / 30)));
break;
}
temp.CurrentDura = (ushort)Math.Min(temp.MaxDura, temp.CurrentDura + item.CurrentDura);
temp.DuraChanged = false;
ReceiveChat("Your mount has been fed.", ChatType.Hint);
Enqueue(new S.ItemRepaired { UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura });
RefreshStats();
break;
default:
return;
}
if (item.Count > 1) item.Count--;
else Info.Inventory[index] = null;
RefreshBagWeight();
p.Success = true;
Enqueue(p);
}
示例6: Chat
//.........這裏部分代碼省略.........
if (!Enum.TryParse(parts.Length > 3 ? parts[2] : parts[1], true, out skill)) return;
if (skill == Spell.None) return;
spellLevel = byte.TryParse(parts.Length > 3 ? parts[3] : parts[2], out spellLevel) ? Math.Min((byte)3, spellLevel) : (byte)0;
if (parts.Length > 3)
{
player = Envir.GetPlayer(parts[1]);
if (player == null)
{
ReceiveChat(string.Format("Player {0} was not found.", parts[1]), ChatType.System);
return;
}
}
if (player.Info.Magics.Any(e => e.Spell == skill))
{
player.Info.Magics.FirstOrDefault(e => e.Spell == skill).Level = spellLevel;
player.ReceiveChat(string.Format("Spell {0} changed to level {1}", skill.ToString(), spellLevel), ChatType.Hint);
return;
}
var magic = new UserMagic(skill) { Level = spellLevel };
player.ReceiveChat(string.Format("You have learned {0} at level {1}", skill.ToString(), spellLevel), ChatType.Hint);
if (player != this)
{
ReceiveChat(string.Format("{0} has learned {1} at level {2}", player.Name, skill.ToString(), spellLevel), ChatType.Hint);
}
player.Info.Magics.Add(magic);
player.Enqueue(magic.GetInfo());
player.RefreshStats();
break;
case "FIND":
if (!IsGM && !HasProbeNecklace) return;
if (Envir.Time < LastProbeTime)
{
ReceiveChat(string.Format("You cannot search for another {0} seconds", (LastProbeTime - Envir.Time) / 1000), ChatType.System);
return;
}
if (parts.Length < 2) return;
player = Envir.GetPlayer(parts[1]);
if (player == null)
{
ReceiveChat(parts[1] + " is not online", ChatType.System);
return;
}
if (player.CurrentMap == null) return;
if (!IsGM)
LastProbeTime = Envir.Time + 180000;
ReceiveChat((string.Format("{0} is located at {1} ({2},{3})", player.Name, player.CurrentMap.Info.Title, player.CurrentLocation.X, player.CurrentLocation.Y)), ChatType.System);
break;
case "LEAVEGUILD":
if (MyGuild == null) return;
if (MyGuildRank == null) return;
MyGuild.DeleteMember(this, Name);
break;
示例7: Act
//.........這裏部分代碼省略.........
monster.Master = player;
monster.MaxPetLevel = 7;
monster.Direction = player.Direction;
monster.ActionTime = SMain.Envir.Time + 1000;
monster.Spawn(player.CurrentMap, player.CurrentLocation);
player.Pets.Add(monster);
}
break;
case ActionType.AddNameList:
path = (string)act.Params[0];
if (File.ReadAllLines(path).All(t => player.Name != t))
{
using (var line = File.AppendText(path))
{
line.WriteLine(player.Name);
}
}
break;
case ActionType.DelNameList:
path = (string)act.Params[0];
File.WriteAllLines(path, File.ReadLines(path).Where(l => l != player.Name).ToList());
break;
case ActionType.ClearNameList:
path = (string)act.Params[0];
File.WriteAllLines(path, new string[] { });
break;
case ActionType.GiveHP:
player.ChangeHP((int)act.Params[0]);
break;
case ActionType.GiveMP:
player.ChangeMP((int)act.Params[0]);
break;
case ActionType.ChangeLevel:
player.Level = (byte) act.Params[0];
player.LevelUp();
break;
case ActionType.SetPkPoint:
player.PKPoints = (int) act.Params[0];
break;
case ActionType.ChangeGender:
switch (player.Info.Gender)
{
case MirGender.Male:
player.Info.Gender = MirGender.Female;
break;
case MirGender.Female:
player.Info.Gender = MirGender.Male;
break;
}
break;
case ActionType.ChangeClass:
var data = (MirClass)act.Params[0];
switch (data)
{
case MirClass.Warrior:
player.Info.Class = MirClass.Warrior;
break;
case MirClass.Taoist:
player.Info.Class = MirClass.Taoist;
break;
case MirClass.Wizard:
player.Info.Class = MirClass.Wizard;
break;
case MirClass.Assassin:
player.Info.Class = MirClass.Assassin;
break;
}
break;
case ActionType.LineMessage:
player.ReceiveChat((string)act.Params[0], (ChatType)act.Params[1]);
break;
case ActionType.GiveSkill:
var magic = new UserMagic((Spell)act.Params[0]) { Level = (byte)act.Params[1] };
player.Info.Magics.Add(magic);
player.Enqueue(magic.GetInfo());
break;
case ActionType.Goto:
player.NPCGoto = true;
player.NPCGotoPage = "[" + act.Params[0] + "]";
break;
case ActionType.Set:
player.Info.Flags[(uint) act.Params[0]] = (bool) act.Params[1];
break;
}
}
}