I added basic broadcasts.
Nothing fancy, just broadcasts any new message once a minute.
Quote:
Originally Posted by mujake
Here's an working NPC to socket weapons made from GodlyArtisan in market
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Redux.Packets.Game;
namespace Redux.Npcs
{
/// <summary>
/// Handles NPC usage for Godly Artisan
/// </summary>
public class NPC_10065 : INpc
{
public NPC_10065(Game_Server.Player _client)
: base(_client)
{
ID = 10065;
Face = 54;
}
public override void Run(Game_Server.Player _client, ushort _linkback)
{
Responses = new List<NpcDialogPacket>();
AddAvatar();
var weapon = _client.Equipment.GetItemBySlot(Enum.ItemLocation.WeaponR);
switch (_linkback)
{
case 0:
AddText("Hello , did you knew that an socketed weapon is better than one without sockets?");
AddText("It costs 1 DragonBall for the first socket and 5 DragonBall for the second one.");
AddOption("Help me put an socket then! .", 1);
AddOption("No. I like it this way.", 255);
break;
case 1:
if (_client.HasItem(1088000) && _client.Equipment.GetItemBySlot(Enum.ItemLocation.WeaponR) != null && weapon.Gem1 == 0)
{
weapon.Gem1 = 255;
_client.Send(ItemInformationPacket.Create(weapon));
_client.DeleteItem(1088000);
AddText("There you go!");
AddOption("Thanks!", 255);
}
else if (_client.HasItem(1088000, 5) && _client.Equipment.GetItemBySlot(Enum.ItemLocation.WeaponR) != null && weapon.Gem1 != 0 && weapon.Gem2 == 0)
{
weapon.Gem2 = 255;
_client.Send(ItemInformationPacket.Create(weapon));
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
AddText("There you go!");
AddOption("Thanks!", 255);
}
else
{
AddText("You don't have enough DragonBalls or your weapon is already socketed!");
AddOption("Ok! .", 255);
}
break;
}
AddFinish();
Send();
}
}
}
Work perfectly now , i think... thanks to aceking who told me where to look for packet update.
Feel free to improve it.
|
Nice job....small suggestion though.
Rather than checking the item slot over and over, why not just use the weapon variable you already initialized and assigned the item to?
Just check if the weapon variable is null rather than pulling the information again.
Will just make it a little more efficient
Quote:
Originally Posted by corbit15
Tried this a few different ways but still can't get it to change the color. Black armor color is 2.
Ill keep trying different ways to see what I come up with
#edit ok I bought armor from the shop thinking maybe it just didn't work with my armor. Still no success, however when I dropped the armor I bought it showed on the ground as black and I picked it up and it was black. So I guess its not updating right?
|
Code:
Structures.ConquerItem arm;
_client.TryGetEquipmentByLocation(Enum.ItemLocation.Armor, out arm);
if (arm != null)
{
arm.Color = 2;
arm.Save();
_client.Send(ItemInformationPacket.Create(arm, Enum.ItemInfoAction.Update));
_client.SpawnPacket.ArmorColor = 2;
_client.SendToScreen(_client.SpawnPacket);
}