[SOLVED]RSP Merchant

For any problems with Dawn of Light website or game server, please direct questions and problems here.

Moderator: Support Team

[SOLVED]RSP Merchant

Postby Tichater » Mon May 18, 2015 4:26 am

i found the realm skill point merchant in the old user files however it doesn't do anything can anyone help me figure out why?

Code: Select all
/* RSP Merchant 1.0.1 by Kakuri Feb 1, 2009 * DOL 1.9.0.1475 / Visual C# 2008 Express * * This NPC will add Realm Specialization Points to a character in exchange for Bounty Points. * If you like your NPCs to stay "in character" with the Camelot world, you may wish to set * HAS_PERSONALITY to false. */ using System; using System.Collections.Generic; using System.Text; using DOL.GS.PacketHandler; using System.Threading; namespace DOL.GS { class RSPMerchant : GameNPC { // Edit these values to customize your RSP Merchant protected const string NAME = "Pando"; protected const string GUILDNAME = "RSP Merchant"; protected const ushort MODELID = 2116; protected const int RSP_COST = 10000; // how many Bounty Points to charge for a single RSP protected const bool HAS_PERSONALITY = true; // END Customization values public override bool AddToWorld() { this.Name = NAME; this.GuildName = GUILDNAME; this.Model = MODELID; this.Level = 60; return base.AddToWorld(); } public override bool Interact( GamePlayer player ) { if ( !base.Interact( player ) ) return false; string msg = "For a fee of " + RSP_COST + " Bounty Points I can give you one Realm Specialization Point.\n"; msg += "\nHow many RSPs would you like to buy?\n"; msg += "[1]\n"; msg += "[5]\n"; msg += "[10]\n"; msg += "\nYou can also whisper an amount to me.\n"; // It's more fun if this BP-granting text is displayed to all players, so they can try it and be mocked! //if ( player.Client.Account.PrivLevel > 1 ) //{ //msg += "\nI can grant you Bounty Points. How many would you like?\n"; msg += "\nIf you are a GM, I can grant you Bounty Points. How many would you like?\n"; msg += "[BP1000] [BP5000] [BP10000]\n"; msg += "You can also whisper an amount to me, like 'BP85000'"; //} ClearChat( player ); SendReply( player, msg ); return true; } public override bool WhisperReceive(GameLiving source, string text) { if ( !base.WhisperReceive( source, text ) ) return false; //GamePlayer player = source as GamePlayer; //if (player == null) return base.WhisperReceive(source, text); //if ( !( source is GamePlayer ) ) return false; GamePlayer player = (GamePlayer)source; ushort purchaseQty; if ( ushort.TryParse( text, out purchaseQty ) ) { PurchaseRSPs( player, purchaseQty ); } else { if ( text.StartsWith( "BP" ) ) { if ( player.Client.Account.PrivLevel > 1 ) { long bpoints = 0; if ( long.TryParse( text.Substring( 2 ), out bpoints ) ) { player.BountyPoints += bpoints; player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayer(); player.SaveIntoDatabase(); player.Out.SendMessage( "You have been granted " + bpoints + " Bounty Points!", eChatType.CT_Staff, eChatLoc.CL_SystemWindow ); return true; } } } } } protected void PurchaseRSPs( GamePlayer player, ushort qty ) { int cost = qty * RSP_COST; if ( cost <= player.BountyPoints ) { player.RealmSpecialtyPoints += qty; player.BountyPoints -= cost; player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayer(); player.SaveIntoDatabase(); SendReply( player, "A pleasure doing business with you!" ); if ( HAS_PERSONALITY ) { this.TargetObject = player; this.TurnTo( player, 2500 ); this.Emote( eEmote.Bow ); player.Out.SendMessage( this.Name + " tucks away " + cost + " little bounty points in his Jell-O murlok bountypouch.", eChatType.CT_Emote, eChatLoc.CL_SystemWindow ); } } else { if ( HAS_PERSONALITY ) { this.TargetObject = player; this.TurnTo( player, 2500 ); this.Emote( eEmote.Laugh ); SendReply( player, "Fancy that! You think out of the kindness of my heart I'm going to give you " + cost + " Bounty Points worth of RSPs for a measly " + player.BountyPoints + " Bounty Points?" ); player.Out.SendMessage( this.Name + " has deducted 1000 BPs from you!", eChatType.CT_Staff, eChatLoc.CL_SystemWindow ); } else { SendReply( player, "You do not have enough Bounty Points!" ); } } } private void SendReply( GamePlayer player, string msg ) { player.Out.SendMessage( msg, eChatType.CT_System, eChatLoc.CL_PopupWindow ); } private void ClearChat( GamePlayer player ) { GameObject obj = player.TargetObject; player.Out.SendChangeTarget( player ); player.Out.SendMessage( "", eChatType.CT_System, eChatLoc.CL_PopupWindow ); player.Out.SendChangeTarget( obj ); } } }
Last edited by Tichater on Sun Jul 12, 2015 8:08 pm, edited 1 time in total.
Tichater
DOL Apprentice
 
Posts: 44
Joined: Thu Aug 14, 2008 8:59 am
Location: Las Vegas, NV

Re: RSP Merchant

Postby Leodagan » Mon May 18, 2015 5:23 am

It's a GameNPC subclass with no "Init" Event Handler...

You have to create NPC of type DOL.GS.RSPMerchant somewhere in world to have any effect...
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: RSP Merchant

Postby Tichater » Mon May 18, 2015 11:42 pm

Thanks for the reply. I added it in-game and the npc spawns and talks but doesn't react other than the chat window popping up with the text in it.
i am starting my programming classes next semester so i barely understand some C# terms. :(
Tichater
DOL Apprentice
 
Posts: 44
Joined: Thu Aug 14, 2008 8:59 am
Location: Las Vegas, NV

Re: RSP Merchant

Postby Leodagan » Tue May 19, 2015 5:40 am

Then I suggest you take some lead before next semester and try online lessons about C# and/or Object-Oriented Programming :)

Or try to contact the author of this script ;)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: RSP Merchant

Postby Tichater » Tue May 19, 2015 7:46 am

i will do both! thank you for the advice!
Tichater
DOL Apprentice
 
Posts: 44
Joined: Thu Aug 14, 2008 8:59 am
Location: Las Vegas, NV


Return to “%s” Support

Who is online

Users browsing this forum: No registered users and 1 guest