本文整理汇总了C#中MabiPacket.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# MabiPacket.GetString方法的具体用法?C# MabiPacket.GetString怎么用?C# MabiPacket.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MabiPacket
的用法示例。
在下文中一共展示了MabiPacket.GetString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, MabiPacket packet)
{
// Usually the second parameter is an empty string,
// but if it's not empty it seems to be tags.
var parameter = (packet != null && packet.GetElementType() == ElementType.String ? packet.GetString() : null);
var tags = new MabiTags(parameter);
var result = this.Start(creature, skill, tags);
Send.SkillStart(creature, skill.Id, parameter);
return result;
}
示例3: Stop
public override SkillResults Stop(MabiCreature creature, MabiSkill skill, MabiPacket packet)
{
var parameter = (packet != null && packet.GetElementType() == ElementType.String ? packet.GetString() : null);
var result = this.Stop(creature, skill);
if (parameter != null)
Send.SkillStop(creature, skill.Id, parameter);
else
Send.SkillStop(creature, skill.Id, 1);
return result;
}
示例4: Stop
public override SkillResults Stop(MabiCreature creature, MabiSkill skill, MabiPacket packet)
{
// Sometimes the second stop parameter is a byte,
// possibly when canceling by moving (eg Rest).
// The client doesn't really seem to care about what we send back though...
var parameter = (packet != null && packet.GetElementType() == ElementType.String ? packet.GetString() : null);
var tags = new MabiTags(parameter);
var result = this.Stop(creature, skill, tags);
if (parameter != null)
Send.SkillStop(creature, skill.Id, parameter);
else
Send.SkillStop(creature, skill.Id, 1);
return result;
}
示例5: 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.Inventory.GetItem(itemOId);
if (item == null)
return SkillResults.Failure;
creature.Temp.SkillItem1 = item;
Send.SkillReady(creature.Client, creature, skill.Id, "");
return SkillResults.Okay;
}
示例6: LoadFromPacket
public void LoadFromPacket(MabiPacket packet)
{
Type = packet.GetInt();
Name = packet.GetString();
Level = (Type == 1) ? packet.GetString() : "";
Info = (Type == 1) ? packet.GetString() : "";
Password = packet.GetString();
MaxSize = packet.GetInt();
// TODO: PartyBoard Support
/*
PartyBoard = packet.GetByte();
005 [..............01] Byte : 1
006 [0000000000000000] Long : 0
007 [0000000400000000] Long : 17179869184
008 [................] String :
009 [..............46] Byte : 70
010 [..............00] Byte : 0
011 [..............00] Byte : 0
012 [................] String :
013 [................] String : Unrestricted
014 [................] String : Unrestricted
015 [................] String :
016 [............0000] Short : 0
017 [........00000000] Int : 0
018 [........00000000] Int : 0
019 [........00000000] Int : 0
020 [..............01] Byte : 1
*/
}
示例7: HandleMoonGateUse
private void HandleMoonGateUse(WorldClient client, MabiPacket packet)
{
var character = client.GetCreatureOrNull(packet.Id) as MabiPC;
if(character == null)
goto L_Fail;
var source = packet.GetString();
var target = packet.GetString();
// Check gates
MoonGate sGate, tGate;
_gates.TryGetValue(source, out sGate);
_gates.TryGetValue(target, out tGate);
if (sGate == null || tGate == null || sGate.Prop.State == "closed")
goto L_Fail;
// Check range to source
if (character.Region != sGate.Region || !WorldManager.InRange(character, sGate.X, sGate.Y, 1000))
goto L_Fail;
// Check if char has target
if (!character.Keywords.Contains(tGate.KeywordId) && !_freeRoaming && !character.Keywords.Contains(10142))
goto L_Fail;
client.Warp(tGate.Region, tGate.X, tGate.Y);
client.Send(new MabiPacket(Op.MoonGateUseR, client.Character.Id).PutByte(true));
return;
L_Fail:
client.Send(new MabiPacket(Op.MoonGateUseR, client.Character.Id).PutByte(false));
}