Here are few NPCs i coded maybe they will be helpful :
CPAdmin
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 [4450] Market Controller
/// </summary>
public class NPC_2071 : INpc
{
public NPC_2071(Game_Server.Player _client)
: base(_client)
{
ID = 2071;
Face = 54;
}
public override void Run(Game_Server.Player _client, ushort _linkback)
{
Responses = new List<NpcDialogPacket>();
AddAvatar();
switch (_linkback)
{
case 0:
AddText("Hello, need to exchange those DragonBalls(220 CPs) or DBScrolls(2200) to CPs to save some space?");
AddText("Witch would you like to exchange?");
AddOption("An DragonBall only .", 1);
AddOption("An DBScroll.", 2);
AddOption("No. I shall stay here.", 255);
break;
case 1:
if (_client.HasItem(1088000))
{
_client.DeleteItem(1088000);
_client.CP += 220;
AddText("There you go.Check out in your inventory!");
AddOption("Thanks!", 255);
}
else
{
AddText("You don't have any DragonBalls.");
AddOption("Ok! .", 255);
}
break;
case 2:
if (_client.HasItem(720028))
{
_client.DeleteItem(720028);
_client.CP += 2200;
AddText("There you go.Check out in your inventory!");
AddOption("Thanks!", 255);
}
else
{
AddText("You don't have any DBScrolls.");
AddOption("Ok! .", 255);
}
break;
}
AddFinish();
Send();
}
}
}
Jail warden to let you exit jail
Code:
/*
* User: cookc
* Date: 9/21/2013
* Time: 8:08 PM
*/
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 [42] Warden
/// </summary>
public class NPC_42 : INpc
{
public NPC_42(Game_Server.Player _client)
:base (_client)
{
ID = 42;
Face = 54;
}
public override void Run(Game_Server.Player _client, ushort _linkback)
{
Responses = new List<NpcDialogPacket>();
AddAvatar();
switch (_linkback)
{
case 0:
AddText("You cannot leave here unless you have paid for your crimes.");
AddOption("Ok! Let me get out from here!", 1);
AddOption("Any chance of a discount?", 2);
AddOption("I would rather rot in hell!", 255);
break;
case 1:
if (_client.PK <= 29)
{
AddText("Give me 1000 silver, I will teleport you out of this place.");
AddOption("Here are 1000 silver", 2);
AddOption("If so, I will stay here.", 255);
}
else
{
AddText("You can leave this place after you pay for your crimes and your PK Points drop below 30!");
AddOption("I would rather rot in hell!", 255);
}
break;
case 2:
if (_client.Money >= 1000)
{
_client.ChangeMap(1002, 429, 378);
_client.Money -= 1000;
}
else
{
AddText("Sorry, you do not have enough money.");
AddOption("I see.", 255);
}
break;
}
AddFinish();
Send();
}
}
}
And MillionaireLee (it works but i can't manage to give _count value 10 and if you have lower than 10 meteors it will still give you an scroll)
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 [4450] Market Controller
/// </summary>
public class NPC_5004 : INpc
{
public NPC_5004(Game_Server.Player _client)
: base(_client)
{
ID = 5004;
Face = 54;
}
public override void Run(Game_Server.Player _client, ushort _linkback)
{
Responses = new List<NpcDialogPacket>();
AddAvatar();
switch (_linkback)
{
case 0:
AddText("Hello,do you need to exchange those DragonBalls or Meteors into Scrolls of 10 to save some space?");
AddText("What would you want to exchange?");
AddOption("Some Meteors .", 1);
AddOption("Some DragonBalls.", 2);
AddOption("No. I shall stay here.", 255);
break;
case 1:
if (_client.HasItem(1088001))
{
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.DeleteItem(1088001);
_client.CreateItem(720027);
AddText("There you go.Check it out in your inventory!");
AddOption("Thanks!", 255);
}
else
{
AddText("You don't have any Meteors.");
AddOption("Ok! .", 255);
}
break;
case 2:
if (_client.HasItem(1088000))
{
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.DeleteItem(1088000);
_client.CreateItem(720028);
AddText("There you go.Check it out in your inventory!");
AddOption("Thanks!", 255);
}
else
{
AddText("You don't have any DragonBalls.");
AddOption("Ok! .", 255);
}
break;
}
AddFinish();
Send();
}
}
}
I am aware this codes can be improved as i am constantly learning.
For the live server I noticed :
- Hercules seems to not function properly (i have 2 blades one is blessed ) it drains the reqiured stamina but it don't damage monsters not even the effect works
- Broadcast (probably not coded yet)
- Seems like it won't recognize scepters as weapons, i get the message : Could not load script for item ID : 481003 (lvl 5 one scepter) but it does this for all of them
- BlackTulip ()but i think you already know, not coded most likely)
I ill keep testing today as i am home and i'll keep editing this post