reincarnate - create and delete characters automatically

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
kali
OpenKore Monk
OpenKore Monk
Posts: 457
Joined: 04 Apr 2008, 10:10

reincarnate - create and delete characters automatically

#1 Post by kali »

Hey everyone. I've been cleaning out my really old drives, and I came across this plugin which I don't think has been published before.

The back story here is that there was a new RO server made, and so everyone had to start fresh. Back then, the items you can get from the novice training grounds (like the novice potions, etc) can be sold to other players.

I made this plugin to automate making a character, running a macro to go through the training grounds and get the max equipment, and then getting out and saving the items to kafra, then reincarnating the character to do it all over again.

This plugin will allow you to add a new command "reincarnate" which will delete your current character and create a new one. Needless to say, don't run the command while logged in an important character or account.

I don't know if this still works in the current version of OpenKore but I'm putting this here to see if anyone else can learn from it or maybe improve on it. It was really useful back then. I made a killing selling novice potions at 10z each (undercutting every other vendor out there). Of course, after the server matured I didn't need to do all these anymore.

Code: Select all

package reincarnate;

#
# This plugin is licensed under the GNU GPL
# Copyright 2006 by kaliwanagan
# --------------------------------------------------
#

# Table of Japanese syllables
my @syllables = qw(  a  i  u  e  o
					ka ki ku ke ko
					ga gi gu ge go 
					sa si su se so
					za zi zu ze zo
					ta ti tu te to
					da di du de do
					na ni nu ne no n
					ha hi hu he ho
					ba bi bu be bo
					ma mi mu me mo
					ya    yu ye yo
					ra ri ru re ro
					wa wi    we wo );

use strict;
use Plugins;
use Globals;
use Log qw(message warning error debug);
use AI;
use Misc;
use Network;
use Network::Send;
use Utils;

Plugins::register('reincarnate', 'automatically delete then (re)create your char', \&onUnload);
my $plugin = Plugins::addHooks(['charSelectScreen', \&charSelectScreen]);
my $command1 = Commands::register(['reincarnate', 'delete then (re)create your char', \&reincarnate_command]);
my $command2 = Commands::register(['quitToCharSelect', 'quits to char select screen', \&quitToCharSelect_command]);

my $charPos = 2;
my $currentCharPos = $charPos;
my $newCharName;
my ($str, $agi, $vit, $int, $dex, $luk, $hair_style, $hair_color) =
   (  9 ,   9 ,   9 ,   1 ,   1 ,   1 ,      2     ,      7);

# State holder
my $status = "ready";

sub onUnload {
	Commands::unregister($command1);
	Commands::unregister($command2);
	Plugins::delHooks($plugin);
}

sub charSelectScreen {
	my $email = $config{email};
	my ($self, $args) = @_;
	
	if (!$chars[$charPos]) {
		$config{char} = $charPos;
		$newCharName = generateName(int(rand(2)) + 4, int(rand(2)) + 4);
		print "$currentCharPos\n";
		print "$newCharName\n";
		$messageSender->sendCharCreate($charPos, $newCharName, $str, $agi, $vit, $int, $dex, $luk, $hair_style, $hair_color);
		$timeout{'charlogin'}{'time'} = time;
		$args->{return} = 2;
		$status = "character created";
		return;
	}
	
	if ($status eq "start") {
		message "$status\n";
		message "Deleting $currentCharPos: $chars[$currentCharPos]{name}, $email\n";
		$messageSender->sendBanCheck($charID);
		$messageSender->sendCharDelete($chars[$currentCharPos]{charID}, $email);
		$timeout{'charlogin'}{'time'} = time;
		$args->{return} = 2;
		$status = "character deleted";
		
	} elsif ($status eq "character deleted") {
		message "$status\n";
		message "Creating $currentCharPos: $newCharName, $email\n";
		$messageSender->sendCharCreate($currentCharPos, $newCharName, $str, $agi, $vit, $int, $dex, $luk, $hair_style, $hair_color);
		$timeout{'charlogin'}{'time'} = time;
		$args->{return} = 2;
		$status = "character created";
		
	} elsif ($status eq "character created") {
		message "$status\n";
		$messageSender->sendCharLogin($currentCharPos);
		$timeout{'charlogin'}{'time'} = time;
		$args->{return} = 1;
		configModify("char", $currentCharPos);
		$status = "ready";
	}
}

sub reincarnate_command {
	# Save the slot position of the current character
	$currentCharPos = $config{char};

	# Alternatively, you can replace $newCharName with
	# some sort of "name generator"
	# $newCharName = $chars[$config{char}]{name};
	#$newCharName = Utils::vocalString(15);
	$newCharName = generateName(int(rand(2)) + 4, int(rand(2)) + 4);
	$hair_color = int(rand(12));
	$hair_style = int(rand(4));
	print "$hair_color, $hair_style\n";
	print "New name: $newCharName\n";

	message "Reincarnating $chars[$config{char}]{name}\n", "system";
	$status = "start";
	$messageSender->sendQuitToCharSelect();
	#configModify("char", "");
	#relog();
}

sub quitToCharSelect_command {
	$messageSender->sendQuitToCharSelect();
}

# string generateName (lengthS [, lengthF])
# Generate a name with lengthS syllables as a surname.
# The second argment is optional - it will be used when
# you want a forename to be generated as well.
# The syllables are from Old Japanese.
# http://en.wikipedia.org/wiki/Old_Japanese_language
#
# Returns:
# A string containing the surname and the optional
# forename, separated by spaces, and the first character
# of both names capitalized.
#
# Example:
#
# print generateName(4, 4)
# Watanabe Sakamoto
#
# TODO:
# Implement phonological rukes as described by the wikipedia entry
# Implement vowel ellisions as described by the wikipedia entry
sub generateName {
	my $lengthS = shift;
	return "" if (!$lengthS);
	my $lengthF = shift;
	my $surname = "";
	my $forename = "";
	
	# Generate the surname
	if ($lengthS) {
		my $i;
		for ($i = 0; $i < $lengthS; $i++) {
			my $syllable = "";
			while (!$syllable) {
				my $candidate = $syllables[int(rand(@syllables))];
				# Do some testing with $candidate here
				$syllable = $candidate;
			}
			$surname .= $syllable;
		}
		$surname = ucfirst($surname);
	}
	
	# Generate the forename
	if ($lengthF) {
		my $i;
		for ($i = 0; $i < $lengthF; $i++) {
			my $syllable = "";
			while (!$syllable) {
				my $candidate = $syllables[int(rand(@syllables))];
				# Do some testing with $candidate here
				$syllable = $candidate;
			}
			$forename .= $syllable;
		}
		$forename = ucfirst($forename);
	}
	
	my $name = $surname;
	$name .= " " . $forename if ($forename);
	return $name;
}

return 1;
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

kali
OpenKore Monk
OpenKore Monk
Posts: 457
Joined: 04 Apr 2008, 10:10

Re: reincarnate - create and delete characters automatically

#2 Post by kali »

And here's the macro I've used. Have fun with it!

Code: Select all

automacro macroRelease_npc {
        console /Could not find an NPC/
	console /but that's not possible./
        # We got disconnected so we need to restart from the beginning,
        # otherwise the macro will go haywire (and we'll likely get
        # suspected of botting)
        call {
                do reincarnate
                release all
        }
}

automacro macroRelease_disconnected {
        console /Disconnected from Map Server/
        # We got disconnected so we need to restart from the beginning,
        # otherwise the macro will go haywire (and we'll likely get
        # suspected of botting)
        call {
                do reincarnate
                release all
        }
}

automacro macroRelease_NPC {
	console /The NPC did not respond/
	# We got disconnected so we need to restart from the beginning,
	# otherwise the macro will go haywire (and we'll likely get
	# suspected of botting)
	call {
		do reincarnate		
		release all
	}
}

automacro macroRelease_out_of_sync {
	console /Error: Out of sync with server/
	# We got disconnected so we need to restart from the beginning,
	# otherwise the macro will go haywire (and we'll likely get
	# suspected of botting)
	call {
		do reincarnate		
		release all
	}
}
automacro macroRelease_timeout {
	console /Timeout on Map Server/
	# We got disconnected so we need to restart from the beginning,
	# otherwise the macro will go haywire (and we'll likely get
	# suspected of botting)
	call {
		do reincarnate		
		release all
	}
}

automacro NewbieAreaOutdoor {
	# We're starting off as a newly-born character
	location new_1-1, new_2-1, new_3-1, new_4-1, new_5-1
	base = 1
	run-once 1
	call TalkToZion
}

macro TalkToZion {

	log Started Novice Ground on $.datetime
	$timer1 = $.time

	# some housekeeping
	# (removed because it causes too many delays)
	#do conf lockMap none
	#do conf autoTalkCont 0
	#do conf route_randomWalk 0
	#do conf attackAuto 0
	#do conf sitAuto_idle 0
	#do conf skillsAddAuto 1
	#do conf skillsAddAuto_list Basic Skill 9
	#do conf statsAddAuto 0
	#do conf statsAddAuto_dontUseBonus 1
	#do conf statsAddAuto_list 99 int
	#do conf itemsTakeAuto 0
	#do conf itemsGatherAuto 0

	# Walk to Zion
	# do move 53 111
	# Talk to Zion
	# do talknpc 53 114 c c r0 c c c c r0 c c c c n
	
	pause 1
	# Talk to Zion 2nd time, get Level 2
	# do talknpc 53 114 c c n
	
	# Walk into Castle
	do move 148 112
}

automacro NewbieAreaIndoor {
	location new_1-2, new_2-2, new_3-2, new_4-2, new_5-2
	run-once 1
	call TalkToReceptionist
}

macro TalkToReceptionist {

	pause 3
	# Move to Receptionist
	do move 99 27
	# Talk to Receptionist
	do talknpc 100 29 c r0 c c n
	
	# Wait for map change
	pause 3

	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect

	# Move to Interface Instructor
	do move 99 104
	# Talk to Interface Instructor
	do talknpc 99 105 c c r0 c c c c c c c c n

	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect
	
	# Move to Skill Instructor
	do move 83 110
	# Talk to Skill Instructor
	do talknpc 83 111 c r0 c c c c c c c c c c c r0 n

	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect

	# Move to Kafra Employee
	do move 117 108
	# Talk to Kafra Employee
	do talknpc 118 108 c c c r1 c r0 c c r1 c c c c c r2 c c c r3 c c c r4 n

	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect

	# Move to Item Instructor
	do move 115 110
	# Talk to Item Instructor
	# do talknpc 115 111 c r0 c a="is Novice Potion" c c a="eq Novice Slippers" c a="eq Tattered Novice Ninja Suit" a="eq Somber Novice Hood" a="eq Novice False Eggshell" c c c c c c r0 c n

	do talknpc 115 111 c r0 c a="is Novice Potion" c c c c c c c c c r0 c n

	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect

	# Walk to Interface Instructor
	do move 100 105
	do talknpc 99 105 c r0 n

	# Wait for map change
	pause 3

	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect

	# Walk to Helper 1
	do move 19 180
	do talknpc 17 182 c c c r0 c c c c c c c c c r3 n

	# Walk to Helper 2
	do move 36 180
	# do talknpc 38 182 c c c c r0 a="eq Novice Main-Gauche" a="eq Novice Guard" c n
	do talknpc 38 182 c c c c r0 c n

	pause 2
	# Check Employee
	
	#do move 105 72
	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect
	#do move 106 129
	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect
	do move 96 170
	
	do talknpc 96 174 c r0 n
	release NewbieAreaIndoor
}

automacro NewbieAreaFinal {
	location new_1-4, new_2-4, new_3-4, new_4-4, new_5-4
	run-once 1
	macro_delay 1
	call TalkToNoviceInstructor
}

macro TalkToNoviceInstructor {

	pause 2
	# do quitToCharSelect
	# pause 3
	# Novice Instructor
	do talknpc 91 22 c c c c r0 c c c c c c c r7
	do move 100 21
	
	# Talk to Hanson - choose thief
	# do talknpc 100 29 c c c c c r0 c c c c r3 r0 r0 r0 r1 r1 c c r1 c r0 c r0 c r0 c c r0 c r0 c r0 c r0 c c r2 c r1 c r0 c r0 c r1 c r2 c r0 c r2 c c c c c c c c c c r0 c c c c c c c c
	
	# Talk to Hanson - choose merchant
	# do talknpc 100 29 c c c c c r0 c c c c r2 r0 r1 r1 r1 r1 c c r1 c r1 c r1 c r1 c c r1 c r1 c r1 c r0 c c r1 c r1 c r2 c r1 c r1 c r0 c r3 c r0 c c c c c c c c c c r0 c c c c c c c c

	# Talk to Hanson - choose swordsman
	# do talknpc 100 29 c c c c c r0 c c c c r0 r0 r0 r0 r0 r0 c c r0 c r0 c r0 c r0 c c r0 c r0 c r0 c r0 c c r0 c r0 c r0 c r0 c r0 c r0 c r0 c r0 c c c c c c c c c c r0 c c c c c c c c

	# Valkyrie special setting to prevent sync errors
	# do quitToCharSelect
	# Talk to Hanson - choose acolyte
	do talknpc 100 29 c c c c c r0 c c c c r2 r0 r0 r1 r0 r1 c c r1 c r1 c r1 c r1 c c r1 c r0 c r0 c r1 c c r1 c r0 c r1 c r1 c r0 c r1 c r3 c r0 c c c c c c c c r0 c c c c c c c c

	log Novice Ground first part done on $.datetime
}

automacro prt_church {
	location prt_church
	run-once 1
	macro_delay 2
	call prt_church_to_prontera
}

macro prt_church_to_prontera {
	do move prontera
}

automacro moc_ruins {
	location moc_ruins
	run-once 1
	macro_delay 2
	call dostorage_moc_ruins
}

automacro alberta_in {
	location alberta_in
	run-once 1
	macro_delay 1
	call dostorage_alberta_in
}

automacro prontera {
	location prontera
	run-once 1
	macro_delay 1
	call do_culvert_quest
}

macro do_culvert_quest {
	# we are in prontera
	#do move 184 294
	# Valkyrie special setting to prevent sync errors
	#do quitToCharSelect
	#do move 121 294
	# Valkyrie special setting to prevent sync errors
	#do quitToCharSelect
	do move 80 110 prt_in
	
	# get warped to culverts entrance + items
	do talknpc 88 105 c r0 c c
}

automacro prt_fild05 {
	location prt_fild05
	run-once 1
	macro_delay 1
	call dostorage_prt_fild05
}

macro dostorage_prt_fild05 {
	$xrand = @rand(1,6)
	$yrand = @rand(1,6)
	$x = @eval (290 + $xrand)
	$y = @eval (224 + $yrand)
	do move $x $y prt_fild05
	do talknpc 290 224 c r1 n
	pause 2
	do storage add @inventory (Novice Potion)
	do storage add @inventory (Red Potion)
	do storage add @inventory (Milk)
	do storage add @inventory (Orange Potion)
	do storage add @inventory (Battle Manual)
#	do uneq knife [3]
#	do uneq cotton shirt
#	do storage add @inventory (Knife [3])
#	do storage add @inventory (Cotton Shirt)
	#$timer2 = @eval($.time - $timer1)
	#log $timer2
	do reincarnate
	release all
}

macro dostorage_moc_ruins {
	# Kafra location is in 59 157
	# Move to a random place near Kafra
	# so that people won't be suspicious
	do move 59 156
	do talknpc 59 157 c r0 n
	pause 2
	do storage add @inventory (Novice Potion)
	do storage add @inventory (Fly Wing)
	do storage add @inventory (Butterfly Wing)
	do storage add @inventory (Free Ticket for Kafra Transportation)
	do storage add @inventory (Free Ticket for Kafra Storage)
	do storage add @inventory (Main Gauche [3])
	do storage add @inventory (Magnifier)
	do storage add @inventory (Red Potion)
	do storage add @inventory (Yellow Potion)
	do storage add @inventory (Green Potion)
	do storage add @inventory (Phracon)
	do storage add @inventory (Powder of Butterfly)
	do reincarnate
	release all
}

macro dostorage_alberta_in {
	# Kafra location is in 113 60
	# Move to a random place near Kafra
	# so that people won't be suspicious
	$xrand = @rand(1,6)
	$yrand = @rand(1,6)
	$x = @eval (113 + $xrand)
	$y = @eval (60 + $yrand)
	do move $x $y alberta
	do talknpc 113 60 c r1 n
	pause 2
	do storage add @inventory (Novice Potion)
	do storage add @inventory (Fly Wing)
	do storage add @inventory (Butterfly Wing)
	do storage add @inventory (Warp Free Ticket)
	do storage add @inventory (Cargo Free Ticket)
	do storage add @inventory (Battle Axe [3])
	do storage add @inventory (Magnifier)
	do storage add @inventory (Red Potion)
	do storage add @inventory (Yellow Potion)
	do storage add @inventory (Green Potion)
	do storage add @inventory (Phracon)
	do storage add @inventory (Powder of Butterfly)
	do storage
	#$timer2 = @eval($.time - $timer1)
	#log $timer2
	do reincarnate
	release all
}
You might see that I've already commented out a number of sections; I've figured out I don't really need to get all of the equipment since I'll be deleting the character anyway. I just need the pots and wings :P
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

Post Reply