本文整理汇总了C#中eInventorySlot.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# eInventorySlot.ToString方法的具体用法?C# eInventorySlot.ToString怎么用?C# eInventorySlot.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eInventorySlot
的用法示例。
在下文中一共展示了eInventorySlot.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommanderSwitchWeapon
/// <summary>
/// Changes the commander's weapon to the specified type
/// </summary>
/// <param name="slot"></param>
/// <param name="aSlot"></param>
/// <param name="weaponType"></param>
protected void CommanderSwitchWeapon(eInventorySlot slot, eActiveWeaponSlot aSlot, string weaponType)
{
if (Inventory == null)
return;
string itemId = string.Format("BD_Commander_{0}_{1}", slot.ToString(), weaponType);
//all weapons removed before
InventoryItem item = Inventory.GetItem(eInventorySlot.RightHandWeapon);
if (item != null) Inventory.RemoveItem(item);
item = Inventory.GetItem(eInventorySlot.TwoHandWeapon);
if (item != null) Inventory.RemoveItem(item);
ItemTemplate temp = GameServer.Database.FindObjectByKey<ItemTemplate>(itemId);
if (temp == null)
{
if (log.IsErrorEnabled)
log.Error(string.Format("Unable to find Bonedancer item: {0}", itemId));
return;
}
Inventory.AddItem(slot, GameInventoryItem.Create<ItemTemplate>(temp));
SwitchWeapon(aSlot);
AddStatsToWeapon();
BroadcastLivingEquipmentUpdate();
}
示例2: CommanderSwitchWeapon
/// <summary>
/// Changes the commander's weapon to the specified type
/// by WHRIA
/// </summary>
/// <param name="slot"></param>
/// <param name="aSlot"></param>
/// <param name="weaponType"></param>
protected void CommanderSwitchWeapon(eInventorySlot slot, eActiveWeaponSlot aSlot, string weaponType)
{
string templateID = string.Format("BD_Commander_{0}_{1}", slot.ToString(), weaponType);
GameNpcInventoryTemplate inventoryTemplate = new GameNpcInventoryTemplate();
if (inventoryTemplate.LoadFromDatabase(templateID))
{
Inventory = new GameNPCInventory(inventoryTemplate);
if (Inventory.AllItems.Count == 0)
{
if (log.IsErrorEnabled)
log.Error(string.Format("Unable to find Bonedancer item: {0}", templateID));
return;
}
}
else
{
if (log.IsErrorEnabled)
log.Error(string.Format("Unable to find Bonedancer item: {0}", templateID));
return;
}
SwitchWeapon(aSlot);
AddStatsToWeapon();
InventoryItem item_left;
InventoryItem item_right;
InventoryItem item_two;
if (Inventory != null)
{
item_left = Inventory.GetItem(eInventorySlot.LeftHandWeapon);
item_right = Inventory.GetItem(eInventorySlot.RightHandWeapon);
item_two = Inventory.GetItem(eInventorySlot.TwoHandWeapon);
switch (weaponType)
{
case "one_handed_sword":
if (item_right != null)
item_right.Type_Damage = (int)eDamageType.Slash;
break;
case "two_handed_sword":
if (item_two != null)
item_right.Type_Damage = (int)eDamageType.Slash;
break;
case "one_handed_hammer":
if (item_right != null)
item_right.Type_Damage = (int)eDamageType.Crush;
break;
case "two_handed_hammer":
if (item_two != null)
item_right.Type_Damage = (int)eDamageType.Crush;
break;
case "one_handed_axe":
if (item_right != null)
item_right.Type_Damage = (int)eDamageType.Thrust;
break;
case "two_handed_axe":
if (item_two != null)
item_right.Type_Damage = (int)eDamageType.Thrust;
break;
}
}
BroadcastLivingEquipmentUpdate();
}