本文整理汇总了C#中Aura.World.World.MabiCreature.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.GetItem方法的具体用法?C# MabiCreature.GetItem怎么用?C# MabiCreature.GetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.World.World.MabiCreature
的用法示例。
在下文中一共展示了MabiCreature.GetItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Prepare
public override SkillResults Prepare(MabiCreature creature, MabiSkill skill, MabiPacket packet, uint castTime)
{
var itemId = packet.GetLong();
var title = packet.GetString();
var author = packet.GetString();
var mml = packet.GetString();
var singing = packet.GetString(); // [180300, NA166 (18.09.2013)] Singing
var hidden = packet.GetByte();
var item = creature.GetItem(itemId);
if (item == null)
return SkillResults.Failure;
var mmlParts = mml.Split(',');
// Check total score length
if (mml.Length > MMLMaxLength)
return SkillResults.Failure;
// Melody length
if (mmlParts[0].Length > skill.RankInfo.Var1)
return SkillResults.Failure;
// Harmony 1 length
if (mmlParts.Length > 1 && mmlParts[1].Length > skill.RankInfo.Var2)
return SkillResults.Failure;
// Harmony 2 length
if (mmlParts.Length > 2 && mmlParts[2].Length > skill.RankInfo.Var3)
return SkillResults.Failure;
creature.Temp.SkillItem1 = item;
var level = SkillRank.Novice;
// Score level = Musical Knowledge rank
var knowledge = creature.Skills.Get(SkillConst.MusicalKnowledge);
if (knowledge != null)
level = knowledge.Rank;
item.Tags.SetString("TITLE", title);
item.Tags.SetString("AUTHOR", author);
item.Tags.SetString("SCORE", MabiZip.Compress(mml));
item.Tags.SetString("SCSING", ""); // [180300, NA166 (18.09.2013)] Singing
item.Tags.SetByte("HIDDEN", hidden);
item.Tags.SetShort("LEVEL", (ushort)level);
Send.SkillUse(creature.Client, creature, skill.Id, itemId);
return SkillResults.Okay;
}
示例2: Start
public override SkillResults Start(MabiCreature creature, MabiSkill skill, MabiTags tags)
{
ulong chairOId = 0;
if (tags.Has("ITEMID"))
chairOId = (ulong)tags.Get("ITEMID");
if (chairOId > 0)
{
// Check item
var item = creature.GetItem(chairOId);
if (item != null && item.Type == ItemType.Misc)
{
// Get chair prop id
var propId = 0u;
var chairInfo = MabiData.ChairDb.Find(item.Info.Class);
if (chairInfo != null)
propId = (!creature.IsGiant ? chairInfo.PropId : chairInfo.GiantPropId);
var pos = creature.GetPosition();
// Effect
if (chairInfo.Effect != 0)
Send.Effect(chairInfo.Effect, creature, true);
// Chair prop
var prop = new MabiProp(propId, creature.Region, pos.X, pos.Y, MabiMath.DirToRad(creature.Direction));
prop.State = "stand";
WorldManager.Instance.AddProp(prop);
// Move char
Send.AssignChair(creature, prop.Id, 1);
// Update chair
prop.ExtraData = string.Format("<xml OWNER='{0}' SITCHAR='{0}'/>", creature.Id);
Send.PropUpdate(prop);
creature.Temp.CurrentChair = chairInfo;
creature.Temp.SittingProp = prop;
}
}
creature.State |= CreatureStates.SitDown;
Send.SitDown(creature);
SkillHelper.GiveSkillExp(creature, skill, 20);
return SkillResults.Okay;
}
示例3: Prepare
public override SkillResults Prepare(MabiCreature creature, MabiSkill skill, MabiPacket packet, uint castTime)
{
// Check item id parameter
var parameters = packet.GetString();
var itemOId = MabiTags.Fetch<ulong>("ITEMID", parameters);
if (itemOId == 0)
return SkillResults.Failure;
// Check item
var item = creature.GetItem(itemOId);
if (item == null)
return SkillResults.Failure;
creature.Temp.SkillItem1 = item;
Send.SkillReady(creature.Client, creature, skill.Id, "");
return SkillResults.Okay;
}