Пример #1
0
 def do_0warp(self, pc, openchattext):
     arg = simplehandle(pc,
                        openchattext,
                        "warp",
                        "!warp map_id ( x y )",
                        "warp mapid or x or y not a number",
                        args=1,
                        extra=True)
     if arg:
         if len(arg) == 3:
             eventobj.systemmessage(pc, "!warp map_id ( x y )")
         else:
             mapid = arg[1]
             if len(arg) >= 4:
                 x = arg[2]
                 y = arg[3]
             else:
                 mapinfo = pc.e.mapdic.get(int(mapid))
                 if mapinfo != None:
                     x = int(mapinfo.centerx)
                     y = int(mapinfo.centery)
                 else:
                     x, y = 128, 128
             print "[ map ]", "warp command", mapid, x, y
             eventobj.warp(pc, int(mapid), int(x), int(y))
Пример #2
0
	def do_1387(self, pc, data, datalength, recvhead, recvtype, recvcontent):
		"""スキル使用"""
		skillid = int(recvcontent[:4], 16)
		targetsid = int(recvcontent[4:12], 16)
		targetx = int(recvcontent[12:14], 16)
		targety = int(recvcontent[14:16], 16)
		skilllv = int(recvcontent[16:18], 16)
		print "[ map ]", "use skill", skillid, "lv", skilllv,
		print "to sid", targetsid, targetx, targety
		if str(int(skillid)) in self.skillhandle.dolist:
			self.skillhandle.run(skillid, pc, skillid, targetsid, \
									targetx, targety, skilllv)
			return
		skill = self.skilldic.get(skillid)
		if skill:
			skillname = str(name.name)
		else:
			skillname = "Unknow"
		#スキル使用通知
		datatype, datacontent = self.createpacket.create1389(pc, skillid, \
											-1, targetx, targety, \
											skilllv, 13, -1)
											#スキルを使用できません
		self.send(datatype, datacontent, pc.mapclient, None)
		#スキル使用通知(スキルを使用できません)
		datatype, datacontent = self.createpacket.create138a(pc, 13)
		self.send(datatype, datacontent, pc.mapclient, None)
		eventobj.systemmessage(pc, "スキル["+skillname+"]は未実装です")
Пример #3
0
	def do_0countitem(self, pc, openchattext):
		arg = simplehandle(pc, openchattext, "countitem", "!countitem item_id", "countitem id not a number")
		if arg:
			itemcount = eventobj.countitem(pc, int(arg))
			msg = "count item %s %s"%(arg, itemcount)
			print "[ map ]", msg
			eventobj.systemmessage(pc, msg)
Пример #4
0
	def do_1387(self, pc, data, datalength, recvhead, recvtype, recvcontent):
		"""スキル使用"""
		skillid = int(recvcontent[:4], 16)
		targetsid = int(recvcontent[4:12], 16)
		targetx = int(recvcontent[12:14], 16)
		targety = int(recvcontent[14:16], 16)
		skilllv = int(recvcontent[16:18], 16)
		print "[ map ]", "use skill", skillid, "lv", skilllv,
		print "to sid", targetsid, targetx, targety
		if str(int(skillid)) in self.skillhandle.dolist:
			self.skillhandle.run(skillid, pc, skillid, targetsid, \
									targetx, targety, skilllv)
			return
		skill = self.skilldic.get(skillid)
		if skill:
			skillname = str(name.name)
		else:
			skillname = "Unknow"
		#スキル使用通知
		datatype, datacontent = self.createpacket.create1389(pc, skillid, \
											-1, targetx, targety, \
											skilllv, 13, -1)
											#スキルを使用できません
		self.send(datatype, datacontent, pc.mapclient, None)
		#スキル使用通知(スキルを使用できません)
		datatype, datacontent = self.createpacket.create138a(pc, 13)
		self.send(datatype, datacontent, pc.mapclient, None)
		eventobj.systemmessage(pc, "スキル["+skillname+"]は未実装です")
Пример #5
0
 def do_0countitem(self, pc, openchattext):
     arg = simplehandle(pc, openchattext, "countitem", "!countitem item_id",
                        "countitem id not a number")
     if arg:
         itemcount = eventobj.countitem(pc, int(arg))
         msg = "count item %s %s" % (arg, itemcount)
         print "[ map ]", msg
         eventobj.systemmessage(pc, msg)
Пример #6
0
	def do_0where(self, pc, openchattext):
		arg = simplehandle(pc, openchattext, "whereraw")
		if arg:
			mapinfo = pc.e.mapdic.get(int(pc.map))
			if mapinfo != None:
				mapname = mapinfo.name
			else:
				mapname = str(pc.map)
			eventobj.systemmessage(pc, "%s [%s] (%s, %s) r(%s, %s)"%(mapname, \
									pc.map, pc.x, pc.y, pc.rawx, pc.rawy))
Пример #7
0
 def do_0where(self, pc, openchattext):
     arg = simplehandle(pc, openchattext, "whereraw")
     if arg:
         mapinfo = pc.e.mapdic.get(int(pc.map))
         if mapinfo != None:
             mapname = mapinfo.name
         else:
             mapname = str(pc.map)
         eventobj.systemmessage(pc, "%s [%s] (%s, %s) r(%s, %s)"%(mapname, \
               pc.map, pc.x, pc.y, pc.rawx, pc.rawy))
Пример #8
0
 def attackmob(self, pc, targetsid):
     #print "attack", targetsid
     with self.lock_moblist:
         target = self.moblist.get(targetsid)
         if target == None:
             print "[ map ]", "AttackThread.attack error / mob not exist", targetsid
             pc.reset_attack_info()
             return
         if target.hp <= 0:
             #print "[ map ]", "AttackThread.attack cheat detect / mob hp < 0", pc.account, targetsid
             pc.reset_attack_info()
             return
         if not target.damagedic.get(pc.sid):
             target.damagedic[pc.sid] = 0
         damage = 10
         target.damagedic[pc.sid] += damage
         target.hp -= damage
         if target.hp < 0:
             target.hp = 0
         state01 = 0
         flag = 1  #HPダメージ
         if target.hp <= 0:
             state01 = 0x200  #行動不能
             flag = 0x4001  #HPダメージ + 消滅モーション
         #攻撃結果
         datatype,datacontent = self.createpacket.create0fa1(pc, target, \
               0, damage, flag) #attacktype, damage, flag
         self.sendmap(datatype, datacontent, self.pclist, pc, None, True)
         #現在のHP/MP/SP/EP
         datatype, datacontent = self.createpacket.create021c(target, True)
         self.sendmap(datatype, datacontent, self.pclist, pc, None, True)
         #モンスターの状態
         datatype, datacontent = self.createpacket.create157c(
             target, state01)
         self.sendmap(datatype, datacontent, self.pclist, pc, None, True)
         if target.hp <= 0:
             pc.reset_attack_info()
             maxdamagefrom = 0
             maxdamage = 0
             for sid, damage in target.damagedic.items():
                 if damage >= maxdamage:
                     maxdamage = damage
                     maxdamagefrom = sid
             for p in self.pclist.itervalues():
                 if not p.online:
                     continue
                 if int(p.map) != int(target.map):
                     continue
                 if int(p.sid) == int(maxdamagefrom):
                     eventobj.systemmessage(p, "基本経験値 0、職業経験値 0を取得しました",
                                            True)
Пример #9
0
	def attackmob(self, pc, targetsid):
		#print "attack", targetsid
		with self.lock_moblist:
			target = self.moblist.get(targetsid)
			if target == None:
				print "[ map ]", "AttackThread.attack error / mob not exist", targetsid
				pc.reset_attack_info()
				return
			if target.hp <= 0:
				#print "[ map ]", "AttackThread.attack cheat detect / mob hp < 0", pc.account, targetsid
				pc.reset_attack_info()
				return
			if not target.damagedic.get(pc.sid):
				target.damagedic[pc.sid] = 0
			damage = 10
			target.damagedic[pc.sid] += damage
			target.hp -= damage
			if target.hp < 0:
				target.hp = 0
			state01 = 0
			flag = 1 #HPダメージ
			if target.hp <= 0:
				state01 = 0x200 #行動不能
				flag = 0x4001 #HPダメージ + 消滅モーション
			#攻撃結果
			datatype,datacontent = self.createpacket.create0fa1(pc, target, \
									0, damage, flag) #attacktype, damage, flag
			self.sendmap(datatype, datacontent, self.pclist, pc, None, True)
			#現在のHP/MP/SP/EP
			datatype,datacontent = self.createpacket.create021c(target, True)
			self.sendmap(datatype, datacontent, self.pclist, pc, None, True)
			#モンスターの状態
			datatype,datacontent = self.createpacket.create157c(target, state01)
			self.sendmap(datatype, datacontent, self.pclist, pc, None, True)
			if target.hp <= 0:
				pc.reset_attack_info()
				maxdamagefrom = 0
				maxdamage = 0
				for sid, damage in target.damagedic.items():
					if damage >= maxdamage:
						maxdamage = damage
						maxdamagefrom = sid
				for p in self.pclist.itervalues():
					if not p.online:
						continue
					if int(p.map) != int(target.map):
						continue
					if int(p.sid) == int(maxdamagefrom):
						eventobj.systemmessage(p, "基本経験値 0、職業経験値 0を取得しました", True)
Пример #10
0
	def do_0printitem(self, pc, openchattext):
		arg = simplehandle(pc, openchattext, "printitem")
		if arg:
			itemlist = pc.sort.item
			equiplist = pc.equiplist()
			for x in itemlist:
				x = int(x)
				if x == 0:
					continue
				if x in equiplist:
					continue
				msg = "printitem %s %s" % (pc.item[x].id, \
					str(pc.item[x].name).decode("utf-8").encode(self.sysenc))
				msgforeco = "printitem "+str(pc.item[x].id)+" "+str(pc.item[x].name)
				print "[ map ]", msg
				eventobj.systemmessage(pc, msgforeco)
Пример #11
0
 def do_0printitem(self, pc, openchattext):
     arg = simplehandle(pc, openchattext, "printitem")
     if arg:
         itemlist = pc.sort.item
         equiplist = pc.equiplist()
         for x in itemlist:
             x = int(x)
             if x == 0:
                 continue
             if x in equiplist:
                 continue
             msg = "printitem %s %s" % (pc.item[x].id, \
              str(pc.item[x].name).decode("utf-8").encode(self.sysenc))
             msgforeco = "printitem " + str(pc.item[x].id) + " " + str(
                 pc.item[x].name)
             print "[ map ]", msg
             eventobj.systemmessage(pc, msgforeco)
Пример #12
0
	def do_0user(self, pc, openchattext):
		arg = simplehandle(pc, openchattext, "user")
		if arg:
			print "[ map ]", "get online player list"
			count = 0
			for p in pc.e.pclist.itervalues():
				if p.online:
					count += 1
					mapinfo = pc.e.mapdic.get(int(p.map))
					if mapinfo != None:
						mapname = mapinfo.name
					else:
						mapname = str(p.map)
					pcname = str(p.name)
					message = pcname+" "+"["+mapname+"]"
					eventobj.systemmessage(pc, message)
			message = "online player"+" "+str(count)
			eventobj.systemmessage(pc, message)
Пример #13
0
 def do_0user(self, pc, openchattext):
     arg = simplehandle(pc, openchattext, "user")
     if arg:
         print "[ map ]", "get online player list"
         count = 0
         for p in pc.e.pclist.itervalues():
             if p.online:
                 count += 1
                 mapinfo = pc.e.mapdic.get(int(p.map))
                 if mapinfo != None:
                     mapname = mapinfo.name
                 else:
                     mapname = str(p.map)
                 pcname = str(p.name)
                 message = pcname + " " + "[" + mapname + "]"
                 eventobj.systemmessage(pc, message)
         message = "online player" + " " + str(count)
         eventobj.systemmessage(pc, message)
Пример #14
0
	def do_0warp(self, pc, openchattext):
		arg = simplehandle(pc, openchattext, "warp", "!warp map_id ( x y )", "warp mapid or x or y not a number", args=1, extra=True)
		if arg:
			if len(arg) == 3:
				eventobj.systemmessage(pc, "!warp map_id ( x y )")
			else:
				mapid = arg[1]
				if len(arg) >= 4:
					x = arg[2]
					y = arg[3]
				else:
					mapinfo = pc.e.mapdic.get(int(mapid))
					if mapinfo != None:
						x = int(mapinfo.centerx)
						y = int(mapinfo.centery)
					else:
						x, y = 128, 128
				print "[ map ]", "warp command", mapid, x, y
				eventobj.warp(pc, int(mapid), int(x), int(y))
Пример #15
0
    def do_10100(self, pc, skillid, targetsid, targetx, targety, skilllv):
        """受け取れ
		対象者のH.E.ARTレベルを、1つ上昇させる"""
        cast = 500
        #スキル使用通知
        #print "targetsid", targetsid
        datatype,datacontent = self.createpacket.create1389(pc, skillid, \
                 targetsid, targetx, targety, \
                 skilllv, 0, cast)
        # 0 = エラーなし
        self.send(datatype, datacontent, pc.mapclient, None, True)  #nodelay
        time.sleep(cast / 1000.0)
        #スキル使用結果通知(対象:単体)
        datatype, datacontent = self.createpacket.create1392(pc, (targetsid,), \
                 skillid, skilllv)
        self.sendmap(datatype, datacontent, self.pclist, pc, None)
        #戦闘状態変更通知
        datatype, datacontent = self.createpacket.create0fa6(pc, 0)
        self.sendmap(datatype, datacontent, self.pclist, pc, None)
        datatype, datacontent = self.createpacket.create0fa6(pc, 1)
        self.sendmap(datatype, datacontent, self.pclist, pc, None)
        eventobj.systemmessage(pc, "スキル[受け取れ]は完全に実装されていません")
Пример #16
0
    def do_3054(self, pc, skillid, targetsid, targetx, targety, skilllv):
        """ヒーリング
		対象のHPを回復する"""
        cast = 500
        #スキル使用通知
        #print "targetsid", targetsid
        datatype,datacontent = self.createpacket.create1389(pc, skillid, \
                 targetsid, targetx, targety, \
                 skilllv, 0, cast)
        self.send(datatype, datacontent, pc.mapclient, None, True)  #nodelay
        time.sleep(cast / 1000.0)
        #スキル使用結果通知(対象:単体)
        datatype, datacontent = self.createpacket.create1392(pc, (targetsid,), \
                 skillid, skilllv, (-100,))
        #マイナス = 回復
        self.sendmap(datatype, datacontent, self.pclist, pc, None)
        #戦闘状態変更通知
        datatype, datacontent = self.createpacket.create0fa6(pc, 0)
        self.sendmap(datatype, datacontent, self.pclist, pc, None)
        datatype, datacontent = self.createpacket.create0fa6(pc, 1)
        self.sendmap(datatype, datacontent, self.pclist, pc, None)
        eventobj.systemmessage(pc, "スキル[ヒーリング]は完全に実装されていません")
Пример #17
0
	def do_3054(self, pc, skillid, targetsid, targetx, targety, skilllv):
		"""ヒーリング
		対象のHPを回復する"""
		cast = 500
		#スキル使用通知
		#print "targetsid", targetsid
		datatype,datacontent = self.createpacket.create1389(pc, skillid, \
											targetsid, targetx, targety, \
											skilllv, 0, cast)
		self.send(datatype, datacontent, pc.mapclient, None, True) #nodelay
		time.sleep(cast/1000.0)
		#スキル使用結果通知(対象:単体)
		datatype, datacontent = self.createpacket.create1392(pc, (targetsid,), \
										 skillid, skilllv, (-100,))
										 #マイナス = 回復
		self.sendmap(datatype, datacontent, self.pclist, pc, None)
		#戦闘状態変更通知
		datatype,datacontent = self.createpacket.create0fa6(pc, 0)
		self.sendmap(datatype, datacontent, self.pclist, pc, None)
		datatype,datacontent = self.createpacket.create0fa6(pc, 1)
		self.sendmap(datatype, datacontent, self.pclist, pc, None)
		eventobj.systemmessage(pc, "スキル[ヒーリング]は完全に実装されていません")
Пример #18
0
	def do_10100(self, pc, skillid, targetsid, targetx, targety, skilllv):
		"""受け取れ
		対象者のH.E.ARTレベルを、1つ上昇させる"""
		cast = 500
		#スキル使用通知
		#print "targetsid", targetsid
		datatype,datacontent = self.createpacket.create1389(pc, skillid, \
											targetsid, targetx, targety, \
											skilllv, 0, cast)
											# 0 = エラーなし
		self.send(datatype, datacontent, pc.mapclient, None, True) #nodelay
		time.sleep(cast/1000.0)
		#スキル使用結果通知(対象:単体)
		datatype, datacontent = self.createpacket.create1392(pc, (targetsid,), \
										 skillid, skilllv)
		self.sendmap(datatype, datacontent, self.pclist, pc, None)
		#戦闘状態変更通知
		datatype,datacontent = self.createpacket.create0fa6(pc, 0)
		self.sendmap(datatype, datacontent, self.pclist, pc, None)
		datatype,datacontent = self.createpacket.create0fa6(pc, 1)
		self.sendmap(datatype, datacontent, self.pclist, pc, None)
		eventobj.systemmessage(pc, "スキル[受け取れ]は完全に実装されていません")
Пример #19
0
def simplehandle(pc,
                 openchattext,
                 commandstr,
                 commandhint=None,
                 errormessage=None,
                 args=1,
                 extra=False):
    # if errormessage, args must be number
    # if commandhint, args > 1; else, args = 1 (like "!help")
    arg = None
    if pc.e.serverobj.gmlevel.get(commandstr) == None:
        eventobj.systemmessage(pc, "gmlevel[%s] not defined" % (commandstr, ))
    elif int(pc.gmlevel) < int(pc.e.serverobj.gmlevel[commandstr]):
        eventobj.systemmessage(pc, "access denied")
    elif not commandhint:
        arg = True
    else:
        command = splitcommand(openchattext)
        try:
            if args < 1:
                args = 1
            if len(command) <= args:
                print "[ map ]", commandhint
                eventobj.systemmessage(pc, commandhint)
                raise Exception
            if args == 1 and not extra:
                if errormessage:
                    arg = str(int(command[1]))
                else:
                    arg = str(command[1])
            else:
                arg = command
                if errormessage:
                    for x in range(0, len(arg)):
                        if x == 0:
                            continue
                        arg[x] = str(int(arg[x]))
        except ValueError:
            arg = None
            print "[ map ]", errormessage, command[1:]
            eventobj.systemmessage(pc,
                                   str(errormessage) + " " + str(command[1:]))
        except Exception:
            arg = None
    return arg
Пример #20
0
def simplehandle(pc, openchattext, commandstr, commandhint=None, errormessage=None, args=1, extra=False):
	# if errormessage, args must be number
	# if commandhint, args > 1; else, args = 1 (like "!help")
	arg = None
	if pc.e.serverobj.gmlevel.get(commandstr) == None:
		eventobj.systemmessage(pc,"gmlevel[%s] not defined"%(commandstr, ))
	elif int(pc.gmlevel) < int(pc.e.serverobj.gmlevel[commandstr]):
		eventobj.systemmessage(pc, "access denied")
	elif not commandhint:
		arg = True
	else:
		command = splitcommand(openchattext)
		try:
			if args < 1:
				args = 1
			if len(command) <= args:
				print "[ map ]", commandhint
				eventobj.systemmessage(pc, commandhint)
				raise Exception
			if args == 1 and not extra:
				if errormessage:
					arg = str(int(command[1]))
				else:
					arg = str(command[1])
			else:
				arg = command
				if errormessage:
					for x in range(0, len(arg)):
						if x == 0:
							continue
						arg[x] = str(int(arg[x]))
		except ValueError:
			arg = None
			print "[ map ]", errormessage, command[1:]
			eventobj.systemmessage(pc, str(errormessage)+" "+str(command[1:]))
		except Exception:
			arg = None
	return arg
Пример #21
0
 def do_0help(self, pc, openchattext):
     eventobj.systemmessage(pc, "---------------------------------------")
     eventobj.systemmessage(pc, "!help")
     eventobj.systemmessage(pc, " !commandlist")
     eventobj.systemmessage(pc, "!user")
     eventobj.systemmessage(pc, " /user")
     eventobj.systemmessage(pc, "/dustbox")
     eventobj.systemmessage(pc, "!reloadscript")
     eventobj.systemmessage(pc, "!printitem")
     eventobj.systemmessage(pc, "!shop shop_id")
     eventobj.systemmessage(pc, "!wh warehouse_id")
     eventobj.systemmessage(pc, "!servermessage servermessage")
     eventobj.systemmessage(pc, " !sm servermessage")
     eventobj.systemmessage(pc, "!item item_id <count>")
     eventobj.systemmessage(pc, " !giveitem item_id <count>")
     eventobj.systemmessage(pc, "!gold num")
     eventobj.systemmessage(pc, " !updategold num")
     eventobj.systemmessage(pc, "!takeitem item_id <count>")
     eventobj.systemmessage(pc, "!countitem item_id")
     eventobj.systemmessage(pc, "!event event_id")
     eventobj.systemmessage(pc, "!warp map_id ( x y )")
     eventobj.systemmessage(pc, "!warpraw map_id ( x y )")
     eventobj.systemmessage(pc, "!hair hair_id")
     eventobj.systemmessage(pc, "!haircolor haircolor_id")
     eventobj.systemmessage(pc, " !hc haircolor_id")
     eventobj.systemmessage(pc, "!face face_id")
     eventobj.systemmessage(pc, "!wig wig_id")
     eventobj.systemmessage(pc, "!ex ex_id")
     eventobj.systemmessage(pc, "!wing wing_id")
     eventobj.systemmessage(pc, "!wingcolor wingcolor_id")
     eventobj.systemmessage(pc, " !wc wingcolor_id")
     eventobj.systemmessage(pc, "!motion motion_id")
     eventobj.systemmessage(pc, "!effect effect_id")
     eventobj.systemmessage(pc, "!speed num")
     eventobj.systemmessage(pc, "!sell")
     eventobj.systemmessage(pc, "!mob mobid")
     eventobj.systemmessage(pc, "!killallmob")
     eventobj.systemmessage(pc, "---------------------------------------")
Пример #22
0
	def do_0help(self, pc, openchattext):
		eventobj.systemmessage(pc, "---------------------------------------")
		eventobj.systemmessage(pc, "!help")
		eventobj.systemmessage(pc, " !commandlist")
		eventobj.systemmessage(pc, "!user")
		eventobj.systemmessage(pc, " /user")
		eventobj.systemmessage(pc, "/dustbox")
		eventobj.systemmessage(pc, "!reloadscript")
		eventobj.systemmessage(pc, "!printitem")
		eventobj.systemmessage(pc, "!shop shop_id")
		eventobj.systemmessage(pc, "!wh warehouse_id")
		eventobj.systemmessage(pc, "!servermessage servermessage")
		eventobj.systemmessage(pc, " !sm servermessage")
		eventobj.systemmessage(pc, "!item item_id <count>")
		eventobj.systemmessage(pc, " !giveitem item_id <count>")
		eventobj.systemmessage(pc, "!gold num")
		eventobj.systemmessage(pc, " !updategold num")
		eventobj.systemmessage(pc, "!takeitem item_id <count>")
		eventobj.systemmessage(pc, "!countitem item_id")
		eventobj.systemmessage(pc, "!event event_id")
		eventobj.systemmessage(pc, "!warp map_id ( x y )")
		eventobj.systemmessage(pc, "!warpraw map_id ( x y )")
		eventobj.systemmessage(pc, "!hair hair_id")
		eventobj.systemmessage(pc, "!haircolor haircolor_id")
		eventobj.systemmessage(pc, " !hc haircolor_id")
		eventobj.systemmessage(pc, "!face face_id")
		eventobj.systemmessage(pc, "!wig wig_id")
		eventobj.systemmessage(pc, "!ex ex_id")
		eventobj.systemmessage(pc, "!wing wing_id")
		eventobj.systemmessage(pc, "!wingcolor wingcolor_id")
		eventobj.systemmessage(pc, " !wc wingcolor_id")
		eventobj.systemmessage(pc, "!motion motion_id")
		eventobj.systemmessage(pc, "!effect effect_id")
		eventobj.systemmessage(pc, "!speed num")
		eventobj.systemmessage(pc, "!sell")
		eventobj.systemmessage(pc, "!mob mobid")
		eventobj.systemmessage(pc, "!killallmob")
		eventobj.systemmessage(pc, "---------------------------------------")