add shop event
This commit is contained in:
parent
da6ee6a29a
commit
6a248db26c
3 changed files with 34 additions and 3 deletions
|
|
@ -3,8 +3,11 @@
|
|||
* @var string|int $sh_id
|
||||
*/
|
||||
include_once "./_common.php";
|
||||
$item = sql_fetch("SELECT * FROM {$g5['shop_table']} shop, {$g5['item_table']} item WHERE shop.it_id = item.it_id AND shop.sh_id = '{$sh_id}'");
|
||||
|
||||
$item = sql_fetch("select * from {$g5['shop_table']} shop, {$g5['item_table']} item where shop.it_id = item.it_id and shop.sh_id = '{$sh_id}'");
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop_ajax.before", $sh_id);
|
||||
}
|
||||
|
||||
if ($item['sh_id']) {
|
||||
|
||||
|
|
@ -32,6 +35,10 @@ if ($item['sh_id']) {
|
|||
}
|
||||
}
|
||||
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop_ajax.before", $item);
|
||||
}
|
||||
|
||||
if (defined('G5_THEME_PATH') && is_file(G5_THEME_PATH . "/shop/shop.item.skin.php")) {
|
||||
include G5_THEME_PATH . "/shop/shop.item.skin.php";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@
|
|||
*/
|
||||
include_once "./_common.php";
|
||||
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop_ajax_update.before");
|
||||
}
|
||||
|
||||
if ($character['ch_id'] && $character['ch_state'] == '승인') {
|
||||
$msg = "";
|
||||
$item = sql_fetch("select * from {$g5['shop_table']} shop, {$g5['item_table']} item where shop.it_id = item.it_id and shop.sh_id = '{$sh_id}'");
|
||||
$item = sql_fetch("SELECT * FROM {$g5['shop_table']} shop, {$g5['item_table']} item WHERE shop.it_id = item.it_id AND shop.sh_id = '{$sh_id}'");
|
||||
|
||||
if ($item['sh_id']) {
|
||||
// 구매 가능한 아이템인지 체크한다.
|
||||
|
|
@ -57,7 +61,7 @@ if ($character['ch_id'] && $character['ch_state'] == '승인') {
|
|||
|
||||
if ($in['cnt'] < $item['sh_has_item_count']) {
|
||||
// 필요 아이템 미소유
|
||||
$has_item_name = get_item_name($item['sh_has_item']);
|
||||
$has_item_name = Item::getName($item['sh_has_item']);
|
||||
$msg .= $has_item_name . j($has_item_name, '이') . " " . $item['sh_has_item_count'] . "개 있어야 살 수 있습니다.<br />";
|
||||
$is_able_buy = false;
|
||||
} else if ($item['sh_use_has_item']) {
|
||||
|
|
@ -121,6 +125,11 @@ if ($character['ch_id'] && $character['ch_state'] == '승인') {
|
|||
}
|
||||
|
||||
if ($is_able_buy) {
|
||||
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop_ajax_update.buyitem_before");
|
||||
}
|
||||
|
||||
Item::giveItem($character['ch_id'], $item['it_id'], $item, 1, "구매", true);
|
||||
|
||||
if ($use_point) {
|
||||
|
|
@ -151,6 +160,10 @@ if ($character['ch_id'] && $character['ch_state'] == '승인') {
|
|||
sql_query("delete from {$g5['title_has_table']} where hi_id = '{$use_has_title}'");
|
||||
}
|
||||
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop_ajax_update.buyitem_after", $use_point, $use_exp_point, $use_inventory_item, $use_inventory_item_count);
|
||||
}
|
||||
|
||||
$msg = "《 " . $item['it_name'] . " 》 구매 되었습니다.";
|
||||
}
|
||||
}
|
||||
|
|
@ -163,3 +176,7 @@ if (defined('G5_THEME_PATH') && is_file(G5_THEME_PATH . "/shop/shop.result.skin.
|
|||
} else {
|
||||
include G5_PATH . "/shop/skin/shop.result.skin.php";
|
||||
}
|
||||
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop_ajax_update.after");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ include_once './_common.php';
|
|||
$g5['title'] = "상점";
|
||||
include_once './_head.php';
|
||||
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop.before");
|
||||
}
|
||||
|
||||
$shop_cate = explode("||", $config['cf_shop_category']);
|
||||
|
||||
if (isset($shop_cate)) {
|
||||
|
|
@ -148,3 +152,6 @@ function ajax_shop_link_url(url, obj_id) {
|
|||
<?php
|
||||
include_once './_tail.php';
|
||||
|
||||
if (class_exists('EventHandler') && method_exists('EventHandler', 'triggerEvent')) {
|
||||
EventHandler::triggerEvent("amber.shop.after");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue