Beispiel #1
0
def takeitem_byiid(pc, item_iid, item_count):
	general.assert_value_range("item_iid", item_iid, general.RANGE_UNSIGNED_INT)
	general.assert_value_range("item_count", item_count, general.RANGE_UNSIGNED_SHORT)
	with pc.lock and pc.user.lock:
		item_exist = pc.item.get(item_iid)
		item_return = None
		error = 0
		if not item_exist:
			error = -2 #存在しないアイテムです
			general.log_error("takeitem byiid: iid not exist", item_iid)
		elif pc.in_equip(item_iid):
			error = -11 #装備中のアイテムは捨てることが出来ません
			general.log_error("takeitem byiid: iid not exist", item_iid)
		elif item_exist.count < item_count:
			error = -22 #ロックアイテムは捨てることが出来ません
			general.log_error("takeitem byiid: item.count < item_count", item_count)
		elif item_exist.count > item_count:
			item_exist.count -= item_count
			item_return = general.copy(item_exist)
			item_return.count = item_count
			pc.map_send("09cf", item_exist, item_iid) #アイテム個数変化
			msg(pc, "%sを%s個失いました"%(item_exist.name, item_count))
		elif item_exist.count == item_count:
			item_return = pc.item_pop(item_iid)
	return item_return, error
Beispiel #2
0
def size(pc, pc_size):
	general.assert_value_range("pc_size", pc_size, general.RANGE_UNSIGNED_INT)
	with pc.lock:
		#default: 1000
		pc.size = pc_size
	with pc.lock and pc.user.lock:
		pc.map_send_map("020f", pc, pc_size) #size
Beispiel #3
0
def takeitem_byiid(pc, item_iid, item_count):
    general.assert_value_range("item_iid", item_iid,
                               general.RANGE_UNSIGNED_INT)
    general.assert_value_range("item_count", item_count,
                               general.RANGE_UNSIGNED_SHORT)
    with pc.lock and pc.user.lock:
        item_exist = pc.item.get(item_iid)
        item_return = None
        error = 0
        if not item_exist:
            error = -2  #存在しないアイテムです
            general.log_error("takeitem byiid: iid not exist", item_iid)
        elif pc.in_equip(item_iid):
            error = -11  #装備中のアイテムは捨てることが出来ません
            general.log_error("takeitem byiid: iid not exist", item_iid)
        elif item_exist.count < item_count:
            error = -22  #ロックアイテムは捨てることが出来ません
            general.log_error("takeitem byiid: item.count < item_count",
                              item_count)
        elif item_exist.count > item_count:
            item_exist.count -= item_count
            item_return = general.copy(item_exist)
            item_return.count = item_count
            pc.map_send("09cf", item_exist, item_iid)  #アイテム個数変化
            msg(pc, "%sを%s個失いました" % (item_exist.name, item_count))
        elif item_exist.count == item_count:
            item_return = pc.item_pop(item_iid)
    return item_return, error
Beispiel #4
0
def whiteout(pc, time_ms):
	general.assert_value_range("time_ms", time_ms, general.RANGE_UNSIGNED_INT)
	with pc.lock and pc.user.lock:
		pc.map_send("0609", 1, 1) #whiteout on
	wait(pc, time_ms)
	with pc.lock and pc.user.lock:
		pc.map_send("0609", 0, 1) #whiteout off
Beispiel #5
0
def npcmotion(pc, npc_id, motion_id, motion_loop=False):
    general.assert_value_range("npc_id", npc_id, general.RANGE_UNSIGNED_INT)
    general.assert_value_range("motion_id", motion_id,
                               general.RANGE_UNSIGNED_SHORT)
    with pc.lock and pc.user.lock:
        #モーション通知
        pc.map_send("121c", pc, npc_id, motion_id, motion_loop)
Beispiel #6
0
def _takeitem(pc, item_id, item_count):
    general.assert_value_range("item_count", item_count,
                               general.RANGE_UNSIGNED_SHORT)
    general.assert_value_range("item_id", item_id, general.RANGE_UNSIGNED_INT)
    if countitem(pc, item_id) < item_count:
        return False
    while item_count:
        for iid in pc.sort.item:
            if pc.in_equip(iid):
                continue
            item_exist = pc.item[iid]
            if item_exist.item_id != item_id:
                continue
            #general.log(item_count, item_exist.count)
            if item_exist.count > item_count:
                item_exist.count -= item_count
                pc.map_send("09cf", item_exist, iid)  #アイテム個数変化
                msg(pc, "%sを%s個失いました" % (item.name, item_count))
            else:
                pc.item_pop(iid)
            break
        else:
            return item_count
    pc.update_item_status()
    return True
Beispiel #7
0
def whiteout(pc, time_ms):
    general.assert_value_range("time_ms", time_ms, general.RANGE_UNSIGNED_INT)
    with pc.lock and pc.user.lock:
        pc.map_send("0609", 1, 1)  #whiteout on
    wait(pc, time_ms)
    with pc.lock and pc.user.lock:
        pc.map_send("0609", 0, 1)  #whiteout off
Beispiel #8
0
def size(pc, pc_size):
    general.assert_value_range("pc_size", pc_size, general.RANGE_UNSIGNED_INT)
    with pc.lock:
        #default: 1000
        pc.size = pc_size
    with pc.lock and pc.user.lock:
        pc.map_send_map("020f", pc, pc_size)  #size
Beispiel #9
0
def petmotion(pc, motion_id, motion_loop=False):
    general.assert_value_range("motion_id", motion_id,
                               general.RANGE_UNSIGNED_SHORT)
    with pc.lock and pc.user.lock:
        if not pc.pet:
            return
        pc.pet.set_motion(motion_id, motion_loop)
Beispiel #10
0
def playbgm(pc, sound_id, loop=1, volume=100):
    general.assert_value_range("sound_id", sound_id,
                               general.RANGE_UNSIGNED_INT)
    general.assert_value_range("volume", volume, (0, 100))
    with pc.lock and pc.user.lock:
        #音楽を再生する
        pc.map_send("05f0", sound_id, (1 if loop else 0), volume)
Beispiel #11
0
def skill_del(pc, skill_id):
    general.assert_value_range("skill_id", skill_id, general.RANGE_SHORT)
    with pc.lock and pc.user.lock:
        if skill_id not in pc.skill_list:
            msg(pc, "skill id %s didn't add" % skill_id)
            return
        pc.skill_list.remove(skill_id)
        pc.map_send("0226", pc, 0)  #スキル一覧
Beispiel #12
0
def warpraw(pc, rawx, rawy):
	general.assert_value_range("rawx", rawx, general.RANGE_SHORT)
	general.assert_value_range("rawy", rawy, general.RANGE_SHORT)
	with pc.lock and pc.user.lock:
		pc.set_raw_coord(rawx, rawy)
		pc.unset_pet()
		pc.map_send_map("11f9", pc, 14) #キャラ移動アナウンス #ワープ
		pc.set_pet()
Beispiel #13
0
def skill_del(pc, skill_id):
	general.assert_value_range("skill_id", skill_id, general.RANGE_SHORT)
	with pc.lock and pc.user.lock:
		if skill_id not in pc.skill_list:
			msg(pc, "skill id %s didn't add"%skill_id)
			return
		pc.skill_list.remove(skill_id)
		pc.map_send("0226", pc, 0) #スキル一覧
Beispiel #14
0
def skill_add(pc, skill_id):
	general.assert_value_range("skill_id", skill_id, general.RANGE_SHORT)
	with pc.lock and pc.user.lock:
		if skill_id in pc.skill_list:
			msg(pc, "skill id %s already add"%skill_id)
			return
		pc.skill_list.append(skill_id)
		pc.map_send("0226", pc, 0) #スキル一覧
Beispiel #15
0
def warpraw(pc, rawx, rawy):
    general.assert_value_range("rawx", rawx, general.RANGE_SHORT)
    general.assert_value_range("rawy", rawy, general.RANGE_SHORT)
    with pc.lock and pc.user.lock:
        pc.set_raw_coord(rawx, rawy)
        pc.unset_pet()
        pc.map_send_map("11f9", pc, 14)  #キャラ移動アナウンス #ワープ
        pc.set_pet()
Beispiel #16
0
def skill_add(pc, skill_id):
    general.assert_value_range("skill_id", skill_id, general.RANGE_SHORT)
    with pc.lock and pc.user.lock:
        if skill_id in pc.skill_list:
            msg(pc, "skill id %s already add" % skill_id)
            return
        pc.skill_list.append(skill_id)
        pc.map_send("0226", pc, 0)  #スキル一覧
Beispiel #17
0
def setgold(pc, gold):
	general.assert_value_range("gold", gold, general.RANGE_INT)
	with pc.lock and pc.user.lock:
		if gold < 0 or gold > 100000000:
			msg(pc, "setgold error: gold < 0 or gold > 100000000 [%s]"%gold)
			return False
		else:
			pc.gold = gold
			pc.map_send("09ec", pc) #ゴールドを更新する、値は更新後の値
			return True
Beispiel #18
0
def setgold(pc, gold):
    general.assert_value_range("gold", gold, general.RANGE_INT)
    with pc.lock and pc.user.lock:
        if gold < 0 or gold > 100000000:
            msg(pc, "setgold error: gold < 0 or gold > 100000000 [%s]" % gold)
            return False
        else:
            pc.gold = gold
            pc.map_send("09ec", pc)  #ゴールドを更新する、値は更新後の値
            return True
Beispiel #19
0
def countitem(pc, item_id):  #not for command
    general.assert_value_range("item_id", item_id, general.RANGE_UNSIGNED_INT)
    item_count = 0
    with pc.lock and pc.user.lock:
        for iid, item in pc.item.iteritems():
            if pc.in_equip(iid):
                continue
            if item.item_id != item_id:
                continue
            item_count += item.count
    return item_count
Beispiel #20
0
def countitem(pc, item_id): #not for command
	general.assert_value_range("item_id", item_id, general.RANGE_UNSIGNED_INT)
	item_count = 0
	with pc.lock and pc.user.lock:
		for iid, item in pc.item.iteritems():
			if pc.in_equip(iid):
				continue
			if item.item_id != item_id:
				continue
			item_count += item.count
	return item_count
Beispiel #21
0
def effect(pc, effect_id, id=None, x=None, y=None, dir=None):
	general.assert_value_range("effect_id", effect_id, general.RANGE_UNSIGNED_INT)
	if id is not None:
		general.assert_value_range("id", id, general.RANGE_INT)
	if x is not None:
		general.assert_value_range("x", x, general.RANGE_UNSIGNED_BYTE)
	if y is not None:
		general.assert_value_range("y", y, general.RANGE_UNSIGNED_BYTE)
	if dir is not None:
		general.assert_value_range("dir", dir, general.RANGE_BYTE)
	with pc.lock and pc.user.lock:
		#エフェクト受信
		pc.map_send_map("060e", pc, effect_id, id, x, y, dir)
Beispiel #22
0
def select(pc, option_list, title="", show_cancel=0):  #not for command
    option_list = filter(None, option_list)
    general.assert_value_range("len(option_list)", len(option_list), (0, 65))
    with pc.lock and pc.user.lock:
        pc.select_result = None
        #NPCのメッセージのうち、選択肢から選ぶもの
        pc.map_send("0604", option_list, title, show_cancel)
    while True:
        with pc.lock:
            if not pc.online:
                return
            if pc.select_result != None:
                return pc.select_result
        time.sleep(0.1)
Beispiel #23
0
def effect(pc, effect_id, id=None, x=None, y=None, dir=None):
    general.assert_value_range("effect_id", effect_id,
                               general.RANGE_UNSIGNED_INT)
    if id is not None:
        general.assert_value_range("id", id, general.RANGE_INT)
    if x is not None:
        general.assert_value_range("x", x, general.RANGE_UNSIGNED_BYTE)
    if y is not None:
        general.assert_value_range("y", y, general.RANGE_UNSIGNED_BYTE)
    if dir is not None:
        general.assert_value_range("dir", dir, general.RANGE_BYTE)
    with pc.lock and pc.user.lock:
        #エフェクト受信
        pc.map_send_map("060e", pc, effect_id, id, x, y, dir)
Beispiel #24
0
def select(pc, option_list, title="", show_cancel=0): #not for command
	option_list = filter(None, option_list)
	general.assert_value_range("len(option_list)", len(option_list), (0, 65))
	with pc.lock and pc.user.lock:
		pc.select_result = None
		#NPCのメッセージのうち、選択肢から選ぶもの
		pc.map_send("0604", option_list, title, show_cancel)
	while True:
		with pc.lock:
			if not pc.online:
				return
			if pc.select_result != None:
				return pc.select_result
		time.sleep(0.1)
Beispiel #25
0
def say(pc, message, npc_name=None, npc_motion_id=131, npc_id=None):
    if npc_id is None:
        npc_id = pc.event_id
    general.assert_value_range("npc_id", npc_id, general.RANGE_UNSIGNED_INT)
    if npc_name is None:
        npc = db.npc.get(pc.event_id)
        if npc: npc_name = npc.name
        else: npc_name = ""
    with pc.lock and pc.user.lock:
        pc.map_send("03f8")  #NPCメッセージのヘッダー
        message = message.replace("$r", "$R").replace("$p", "$P")
        for message_line in message.split("$R"):
            pc.map_send("03f7", message_line + "$R", npc_name, npc_motion_id,
                        npc_id)  #NPCメッセージ
        pc.map_send("03f9")  #NPCメッセージのフッター
Beispiel #26
0
def say(pc, message, npc_name=None, npc_motion_id=131, npc_id=None):
	if npc_id is None:
		npc_id = pc.event_id
	general.assert_value_range("npc_id", npc_id, general.RANGE_UNSIGNED_INT)
	if npc_name is None:
		npc = db.npc.get(pc.event_id)
		if npc: npc_name = npc.name
		else: npc_name = ""
	with pc.lock and pc.user.lock:
		pc.map_send("03f8") #NPCメッセージのヘッダー
		message = message.replace("$r", "$R").replace("$p", "$P")
		for message_line in message.split("$R"):
			pc.map_send("03f7", 
				message_line+"$R", npc_name, npc_motion_id, npc_id) #NPCメッセージ
		pc.map_send("03f9") #NPCメッセージのフッター
Beispiel #27
0
def _item(pc, item_id, item_count):
	general.assert_value_range("item_count", item_count, general.RANGE_UNSIGNED_SHORT)
	general.assert_value_range("item_id", item_id, general.RANGE_UNSIGNED_INT)
	if len(pc.item) >= env.MAX_ITEM_STOCK:
		msg(pc, "script.item error: stock limit")
		return False
	while item_count:
		item = general.get_item(item_id)
		item_stock_exist = False
		if item.stock:
			for iid in pc.sort.item:
				item_exist = pc.item[iid]
				if item_exist.count >= 999:
					continue
				if item_exist.item_id != item_id:
					continue
				if item_exist.count+item_count > 999:
					item_count_add = 999-item_exist.count
					item_count -= item_count_add
					item_exist.count += item_count_add
				else:
					item_count_add = item_count
					item_count = 0
					item_exist.count += item_count_add
				pc.map_send("09cf", item_exist, iid) #アイテム個数変化
				msg(pc, "%sを%s個入手しました"%(
					item_exist.name, item_count_add
				))
				item_stock_exist = True
				break
		if item_stock_exist:
			continue
		if item_count > 999:
			item.count = 999
			item_count -= 999
		else:
			item.count = item_count
			item_count = 0
		pc.item_append(item)
	pc.update_item_status()
	return True
Beispiel #28
0
def playjin(pc, sound_id, loop=0, volume=100, balance=50):
	general.assert_value_range("sound_id", sound_id, general.RANGE_UNSIGNED_INT)
	general.assert_value_range("volume", volume, (0, 100))
	general.assert_value_range("balance", balance, (0, 100))
	with pc.lock and pc.user.lock:
		#ジングルを再生する
		pc.map_send("05fa", sound_id, (1 if loop else 0), volume, balance)
Beispiel #29
0
def _item(pc, item_id, item_count):
    general.assert_value_range("item_count", item_count,
                               general.RANGE_UNSIGNED_SHORT)
    general.assert_value_range("item_id", item_id, general.RANGE_UNSIGNED_INT)
    if len(pc.item) >= env.MAX_ITEM_STOCK:
        msg(pc, "script.item error: stock limit")
        return False
    while item_count:
        item = general.get_item(item_id)
        item_stock_exist = False
        if item.stock:
            for iid in pc.sort.item:
                item_exist = pc.item[iid]
                if item_exist.count >= 999:
                    continue
                if item_exist.item_id != item_id:
                    continue
                if item_exist.count + item_count > 999:
                    item_count_add = 999 - item_exist.count
                    item_count -= item_count_add
                    item_exist.count += item_count_add
                else:
                    item_count_add = item_count
                    item_count = 0
                    item_exist.count += item_count_add
                pc.map_send("09cf", item_exist, iid)  #アイテム個数変化
                msg(pc, "%sを%s個入手しました" % (item_exist.name, item_count_add))
                item_stock_exist = True
                break
        if item_stock_exist:
            continue
        if item_count > 999:
            item.count = 999
            item_count -= 999
        else:
            item.count = item_count
            item_count = 0
        pc.item_append(item)
    pc.update_item_status()
    return True
Beispiel #30
0
def warehouse(pc, warehouse_id):
	general.assert_value_range("warehouse_id", warehouse_id, general.RANGE_BYTE)
	num_max = 300
	num_here = 0
	num_all = 0
	with pc.lock:
		for item in pc.warehouse.itervalues():
			num_all += 1
			if item.warehouse == warehouse_id:
				num_here += 1
	with pc.lock and pc.user.lock:
		#倉庫インベントリーヘッダ
		pc.map_send("09f6", warehouse_id, num_here, num_all, num_max)
		for iid, item in pc.warehouse.iteritems():
			if item.warehouse == warehouse_id:
				part = 30 #倉庫
			else:
				part = item.warehouse
			#倉庫インベントリーデータ
			pc.map_send("09f9", item, iid, part)
		pc.warehouse_open = warehouse_id
		pc.map_send("09fa") #倉庫インベントリーフッタ
Beispiel #31
0
def playjin(pc, sound_id, loop=0, volume=100, balance=50):
    general.assert_value_range("sound_id", sound_id,
                               general.RANGE_UNSIGNED_INT)
    general.assert_value_range("volume", volume, (0, 100))
    general.assert_value_range("balance", balance, (0, 100))
    with pc.lock and pc.user.lock:
        #ジングルを再生する
        pc.map_send("05fa", sound_id, (1 if loop else 0), volume, balance)
Beispiel #32
0
def warehouse(pc, warehouse_id):
    general.assert_value_range("warehouse_id", warehouse_id,
                               general.RANGE_BYTE)
    num_max = 300
    num_here = 0
    num_all = 0
    with pc.lock:
        for item in pc.warehouse.itervalues():
            num_all += 1
            if item.warehouse == warehouse_id:
                num_here += 1
    with pc.lock and pc.user.lock:
        #倉庫インベントリーヘッダ
        pc.map_send("09f6", warehouse_id, num_here, num_all, num_max)
        for iid, item in pc.warehouse.iteritems():
            if item.warehouse == warehouse_id:
                part = 30  #倉庫
            else:
                part = item.warehouse
            #倉庫インベントリーデータ
            pc.map_send("09f9", item, iid, part)
        pc.warehouse_open = warehouse_id
        pc.map_send("09fa")  #倉庫インベントリーフッタ
Beispiel #33
0
def warp(pc, map_id, x=None, y=None):
	if x != None and y != None:
		general.assert_value_range("x", x, general.RANGE_UNSIGNED_BYTE)
		general.assert_value_range("y", y, general.RANGE_UNSIGNED_BYTE)
	with pc.lock and pc.user.lock:
		if map_id != pc.map_obj.map_id:
			pc.set_visible(False) #set visible false before 11fd
			if not pc.set_map(map_id):
				raise ValueError("map_id %d not found."%map_id)
			if x is not None and y is not None:
				pc.set_coord(x, y)
			else:
				pc.set_coord(pc.map_obj.centerx, pc.map_obj.centery)
			pc.set_dir(0)
			pc.map_send("11fd", pc) #マップ変更通知
			pc.map_send("122a") #モンスターID通知
		else:
			if x is not None and y is not None:
				pc.set_coord(x, y)
			else:
				pc.set_coord(pc.map_obj.centerx, pc.map_obj.centery)
			pc.unset_pet()
			pc.map_send_map("11f9", pc, 14) #キャラ移動アナウンス #ワープ
			pc.set_pet()
Beispiel #34
0
def _takeitem(pc, item_id, item_count):
	general.assert_value_range("item_count", item_count, general.RANGE_UNSIGNED_SHORT)
	general.assert_value_range("item_id", item_id, general.RANGE_UNSIGNED_INT)
	if countitem(pc, item_id) < item_count:
		return False
	while item_count:
		for iid in pc.sort.item:
			if pc.in_equip(iid):
				continue
			item_exist = pc.item[iid]
			if item_exist.item_id != item_id:
				continue
			#general.log(item_count, item_exist.count)
			if item_exist.count > item_count:
				item_exist.count -= item_count
				pc.map_send("09cf", item_exist, iid) #アイテム個数変化
				msg(pc, "%sを%s個失いました"%(item.name, item_count))
			else:
				pc.item_pop(iid)
			break
		else:
			return item_count
	pc.update_item_status()
	return True
Beispiel #35
0
def warp(pc, map_id, x=None, y=None):
    if x != None and y != None:
        general.assert_value_range("x", x, general.RANGE_UNSIGNED_BYTE)
        general.assert_value_range("y", y, general.RANGE_UNSIGNED_BYTE)
    with pc.lock and pc.user.lock:
        if map_id != pc.map_obj.map_id:
            pc.set_visible(False)  #set visible false before 11fd
            if not pc.set_map(map_id):
                raise ValueError("map_id %d not found." % map_id)
            if x is not None and y is not None:
                pc.set_coord(x, y)
            else:
                pc.set_coord(pc.map_obj.centerx, pc.map_obj.centery)
            pc.set_dir(0)
            pc.map_send("11fd", pc)  #マップ変更通知
            pc.map_send("122a")  #モンスターID通知
        else:
            if x is not None and y is not None:
                pc.set_coord(x, y)
            else:
                pc.set_coord(pc.map_obj.centerx, pc.map_obj.centery)
            pc.unset_pet()
            pc.map_send_map("11f9", pc, 14)  #キャラ移動アナウンス #ワープ
            pc.set_pet()
Beispiel #36
0
def wait(pc, time_ms):  #not for command
    general.assert_value_range("time_ms", time_ms, general.RANGE_UNSIGNED_INT)
    with pc.lock and pc.user.lock:
        pc.map_send("05eb", time_ms)  #イベント関連のウェイト
    time.sleep(time_ms / 1000.0)
Beispiel #37
0
def npcmotion(pc, npc_id, motion_id, motion_loop=False):
	general.assert_value_range("npc_id", npc_id, general.RANGE_UNSIGNED_INT)
	general.assert_value_range("motion_id", motion_id, general.RANGE_UNSIGNED_SHORT)
	with pc.lock and pc.user.lock:
		#モーション通知
		pc.map_send("121c", pc, npc_id, motion_id, motion_loop) 
Beispiel #38
0
def hidenpc(pc, npc_id):
    general.assert_value_range("npc_id", npc_id, general.RANGE_UNSIGNED_INT)
    with pc.lock and pc.user.lock:
        pc.map_send("05e3", npc_id)  #hide npc
Beispiel #39
0
def emotion(pc, emotion_id):
    general.assert_value_range("emotion_id", emotion_id,
                               general.RANGE_UNSIGNED_SHORT)
    with pc.lock and pc.user.lock:
        pc.map_send_map("1217", pc, emotion_id)  #emotion
Beispiel #40
0
def speed(pc, speed):
	general.assert_value_range("speed", speed, general.RANGE_SHORT)
	with pc.lock and pc.user.lock:
		pc.status.speed = speed
		pc.map_send_map("1239", pc) #キャラ速度通知・変更
Beispiel #41
0
def petmotion(pc, motion_id, motion_loop=False):
	general.assert_value_range("motion_id", motion_id, general.RANGE_UNSIGNED_SHORT)
	with pc.lock and pc.user.lock:
		if not pc.pet:
			return
		pc.pet.set_motion(motion_id, motion_loop)
Beispiel #42
0
def wingcolor(pc, wingcolor_id):
    general.assert_value_range("wingcolor_id", wingcolor_id,
                               general.RANGE_BYTE)
    with pc.lock:
        pc.wingcolor = wingcolor_id
    update(pc)
Beispiel #43
0
def ex(pc, ex_id):
    general.assert_value_range("ex_id", ex_id, general.RANGE_BYTE)
    with pc.lock:
        pc.ex = ex_id
    update(pc)
Beispiel #44
0
def wig(pc, wig_id):
    general.assert_value_range("wig_id", wig_id, general.RANGE_SHORT)
    with pc.lock:
        pc.wig = wig_id
    update(pc)
Beispiel #45
0
def face(pc, face_id):
    general.assert_value_range("face_id", face_id, general.RANGE_SHORT)
    with pc.lock:
        pc.face = face_id
    update(pc)
Beispiel #46
0
def haircolor(pc, haircolor_id):
    general.assert_value_range("haircolor_id", haircolor_id,
                               general.RANGE_BYTE)
    with pc.lock:
        pc.haircolor = haircolor_id
    update(pc)
Beispiel #47
0
def motion(pc, motion_id, motion_loop=False):
    general.assert_value_range("motion_id", motion_id,
                               general.RANGE_UNSIGNED_SHORT)
    pc.set_motion(motion_id, motion_loop)
Beispiel #48
0
def motion(pc, motion_id, motion_loop=False):
	general.assert_value_range("motion_id", motion_id, general.RANGE_UNSIGNED_SHORT)
	pc.set_motion(motion_id, motion_loop)
Beispiel #49
0
def speed(pc, speed):
    general.assert_value_range("speed", speed, general.RANGE_SHORT)
    with pc.lock and pc.user.lock:
        pc.status.speed = speed
        pc.map_send_map("1239", pc)  #キャラ速度通知・変更
Beispiel #50
0
def wig(pc, wig_id):
	general.assert_value_range("wig_id", wig_id, general.RANGE_SHORT)
	with pc.lock:
		pc.wig = wig_id
	update(pc)
Beispiel #51
0
def wingcolor(pc, wingcolor_id):
	general.assert_value_range("wingcolor_id", wingcolor_id, general.RANGE_BYTE)
	with pc.lock:
		pc.wingcolor = wingcolor_id
	update(pc)
Beispiel #52
0
def haircolor(pc, haircolor_id):
	general.assert_value_range("haircolor_id", haircolor_id, general.RANGE_BYTE)
	with pc.lock:
		pc.haircolor = haircolor_id
	update(pc)
Beispiel #53
0
def emotion_ex(pc, emotion_ex_id):
    general.assert_value_range("emotion_ex_id", emotion_ex_id,
                               general.RANGE_UNSIGNED_BYTE)
    with pc.lock and pc.user.lock:
        pc.map_send_map("1d0c", pc, emotion_ex_id)  #emotion_ex
Beispiel #54
0
def emotion_ex(pc, emotion_ex_id):
	general.assert_value_range(
		"emotion_ex_id", emotion_ex_id, general.RANGE_UNSIGNED_BYTE
	)
	with pc.lock and pc.user.lock:
		pc.map_send_map("1d0c", pc, emotion_ex_id) #emotion_ex
Beispiel #55
0
def ex(pc, ex_id):
	general.assert_value_range("ex_id", ex_id, general.RANGE_BYTE)
	with pc.lock:
		pc.ex = ex_id
	update(pc)
Beispiel #56
0
def emotion(pc, emotion_id):
	general.assert_value_range("emotion_id", emotion_id, general.RANGE_UNSIGNED_SHORT)
	with pc.lock and pc.user.lock:
		pc.map_send_map("1217", pc, emotion_id) #emotion
Beispiel #57
0
def face(pc, face_id):
	general.assert_value_range("face_id", face_id, general.RANGE_SHORT)
	with pc.lock:
		pc.face = face_id
	update(pc)
Beispiel #58
0
def playbgm(pc, sound_id, loop=1, volume=100):
	general.assert_value_range("sound_id", sound_id, general.RANGE_UNSIGNED_INT)
	general.assert_value_range("volume", volume, (0, 100))
	with pc.lock and pc.user.lock:
		#音楽を再生する
		pc.map_send("05f0", sound_id, (1 if loop else 0), volume)
Beispiel #59
0
def wait(pc, time_ms): #not for command
	general.assert_value_range("time_ms", time_ms, general.RANGE_UNSIGNED_INT)
	with pc.lock and pc.user.lock:
		pc.map_send("05eb", time_ms) #イベント関連のウェイト
	time.sleep(time_ms/1000.0)
Beispiel #60
0
def hidenpc(pc, npc_id):
	general.assert_value_range("npc_id", npc_id, general.RANGE_UNSIGNED_INT)
	with pc.lock and pc.user.lock:
		pc.map_send("05e3", npc_id) #hide npc